Page 1 of 1
Can I force display of "hidden" sidebar item?
Posted: Wed Jun 19, 2013 10:25 pm
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
Re: Can I force display of "hidden" sidebar item?
Posted: Thu Jun 20, 2013 10:06 am
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
Re: Can I force display of "hidden" sidebar item?
Posted: Thu Jun 20, 2013 4:51 pm
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.
Re: Can I force display of "hidden" sidebar item?
Posted: Fri Jun 21, 2013 2:48 pm
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
Re: Can I force display of "hidden" sidebar item?
Posted: Fri Jun 21, 2013 5:19 pm
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
Re: Can I force display of "hidden" sidebar item?
Posted: Tue Jun 25, 2013 11:32 am
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
Re: Can I force display of "hidden" sidebar item?
Posted: Mon Jul 29, 2013 6:58 pm
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
Re: Can I force display of "hidden" sidebar item?
Posted: Mon Jul 29, 2013 7:11 pm
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.
Re: Can I force display of "hidden" sidebar item?
Posted: Mon Jul 29, 2013 9:27 pm
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
Re: Can I force display of "hidden" sidebar item?
Posted: Tue Jul 30, 2013 10:02 am
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.
Re: Can I force display of "hidden" sidebar item?
Posted: Tue Jul 30, 2013 1:40 pm
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?
Re: Can I force display of "hidden" sidebar item?
Posted: Tue Jul 30, 2013 5:26 pm
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