Can I force display of "hidden" sidebar item?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
jabeavers
Regular
Posts: 22
Joined: Thu Oct 07, 2010 4:31 pm

Can I force display of "hidden" sidebar item?

Post by jabeavers »

I have configured sidebar plugins of categories for different pages and/or parts of pages. I have a right side plugin for the side bar, and I have a left side plugin for the home page (instead of entries). I also have a drop-down navigation menu with the categories. I'd like all three to be styled or output different html.

Therefore, I am forcing the display of the categories plugin on different pages at different times with {serendipity_printSidebar side="left/right"}. However, the addition of the third categories plugin will mess everything up, so I thought {serendipity_printSidebar side="hidden"} might work, but it didn't. Can you tell me how I can force the display of that plugin with smarty code.

PS. I have tested with left/right in header.tpl, but it doesn't display anything. I've put in {php} require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); {/php} right before my call in the header, but it still doesn't display any categories. How do I get the categories plugin loaded in header.tpl, too?

John
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can I force display of "hidden" sidebar item?

Post by garvinhicking »

Hi!

Hm, actually "side=hidden" should work, just like left/right. If you use side="hidden" you might also need to combine it with class="serendipity_categories_plugin".

Another option is to set up custom sidebars via config.inc.php of your own template, so you could have sidebars called "home", "subpage" and whatever, and use those names to emit the sidebars. Check http://www.s9y.org/137.html on how to set config.inc.php for "sidebars" values.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jabeavers
Regular
Posts: 22
Joined: Thu Oct 07, 2010 4:31 pm

Re: Can I force display of "hidden" sidebar item?

Post by jabeavers »

Thanks Garvin. I still have the problem that the sidebar data doesn't seem to be available in my header.tpl file, but is available in content.tpl (but I need it in header, which is called prior to content).

How do I load the sidebar/plugins in header.tpl instead of content.tpl?

Thanks.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can I force display of "hidden" sidebar item?

Post by garvinhicking »

Hi!

Can you show your current template files (i.e. put it on http://gist.github.com/)? I'm not sure I fully understand what you try to do.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jabeavers
Regular
Posts: 22
Joined: Thu Oct 07, 2010 4:31 pm

Re: Can I force display of "hidden" sidebar item?

Post by jabeavers »

header.tpl:
https://gist.github.com/jabeavers/5831866

The website it is on:
http://www.gravleyenterprises.com/blog/

There is something in the content.tpl that loads the plugin data (or, in the control file for content.tpl), but that call hasn't happened when header.tpl is called, so the plugin information is not accessable in header.tpl. I tried putting a line in header.tpl to load the data, but it didn't seem to work. My boss is wanting this yesterday, and I know we're on opposite sides of the world, but if you can figure this out, I would certainly appreciate it!

John
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can I force display of "hidden" sidebar item?

Post by garvinhicking »

Hi!

Sorry for my outtime, I was gone for the weekend.

Uhm. How do you actually load your header.tpl? The code I see there is what s9y usually outputs in its index.tpl file?

Usually, you should be able to put {serendipity_printSidebar} in any tpl.file that s9y loads, like index.tpl, content.tpl and entries.tpl...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jabeavers
Regular
Posts: 22
Joined: Thu Oct 07, 2010 4:31 pm

Re: Can I force display of "hidden" sidebar item?

Post by jabeavers »

Sorry, I got busy doing other work......

Here's my index.tpl file, which is how I call header.tpl:

{include file="header.tpl"}
{if $is_raw_mode != true}
{$CONTENT}
{/if}

{$raw_data}

{serendipity_hookPlugin hook="frontend_footer"}
{if $is_embedded != true}
{php}include 'templates/gravley/footer.php'; {/php}
</div>
</div>
<div id="footerBottom"></div>
</body>
</html>
{/if}


In content.tpl, when I call:

{serendipity_showPlugin class="serendipity_categories_plugin" side="right"}

if works perfectly. But in header.tpl with the same code, I get no content.

John
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Can I force display of "hidden" sidebar item?

Post by Timbalu »

Please note:

Code: Select all

{php}is not allowed to use any more with Smarty3.1/Serendipity 1.7 Series{/php}
http://www.smarty.net/docs/en/language.function.php.tpl

I personally do not want to support this again.
There are easy enough ways to workaround this eg. in your templates config.inc.php file ...

I know you are still using Smarty 2 and S9y 1.5.4, but that 3.1 documentary page still shows the right way to include php files eg. include('/path/to/display_weather.php'); even if definitely marked as deprecated, surrounding it by {php} tags.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
jabeavers
Regular
Posts: 22
Joined: Thu Oct 07, 2010 4:31 pm

Re: Can I force display of "hidden" sidebar item?

Post by jabeavers »

Well, I bypassed s9y and simply added a function in config.inc.php that queries the db, formats the url, and outputs the code that I need for the menu.

I don't understand why it wasn't working, and it would be nice to have it taken care of completely by s9y, but that didn't happen, so I did it my way.

Thanks everyone for the help.

John
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Can I force display of "hidden" sidebar item?

Post by Timbalu »

Look into this (old) Smarty 2 documentary about including...
http://www.smarty.net/docsv2/en/languag ... nclude.tpl

Code: Select all

{include file='/best/use/full/file/system/path/to/templates/name/header.tpl'}
or make sure the theme can really read and find a pathless filename dropped in same dir.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can I force display of "hidden" sidebar item?

Post by garvinhicking »

Hi!

That's strange, the showPlugin code should work in header.tpl, it is an isolated smarty function.

Just for experimentation; if you copy&paste the contents of header.tpl in the place where {include file=...} stands, does it then work?

What content does header.tpl contain exactly?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
jabeavers
Regular
Posts: 22
Joined: Thu Oct 07, 2010 4:31 pm

Re: Can I force display of "hidden" sidebar item?

Post by jabeavers »

I put a link up earlier with the contents of header.tpl: https://gist.github.com/jabeavers/5831866
I've updated the link to reflect the current changes.

I haven't tried copying and pasting the code from header into index.tpl. I might try that later. Since I've got it working, I have other jobs that need my attention now. I'll get back to this when I can.

John
Post Reply