Page 1 of 1
Static pages plugin -- hiding the sidebar
Posted: Tue Oct 24, 2006 1:34 am
by jshatch
Can you hide the s9y sidebar for certain static pages (such as about page, etc)? It would be nice to be able to do that for certainpages, perhaps with a special page type or something. Possible? If so, how?
Re: Static pages plugin -- hiding the sidebar
Posted: Tue Oct 24, 2006 10:49 am
by garvinhicking
Hi!
There is a sidebarhider plugin that can hide sidebar elements for certain serendipity category views.
But not for staticpages; for that you would need to use Smarty syntax and edit your sidebar.tpl file and add checks like:
Code: Select all
{if $staticpage.pagetitle != 'My special page'}
...show sidebar element here...
{/if}
Using that, you can customly modify when the sidebar prints which elements. It is complicated, but the only really flexible solution.
It is much more complex to make the staticpage plugin recognize elements outside of its own scope (like sidebar elements), so changing the plugin would be a longterm solution, and nothing that can be done easily right now.
HTH,
Garvin
Posted: Tue Oct 24, 2006 6:41 pm
by jshatch
I know of one plugin that does hide the sidebar just like I want but I do not know how it does it. The g2embed plugin hides the sidebar when viewing photos or if you are logged in to the gallery but it shows the sidebar if you are not logged in. I was able to comment out an if statement in that plugin to make it always hide the sidebar. However I do not know how to implement something like that in the staticpages plugin.
My hope is to be able to put something in plugin_staticpage.tpl (or create a new .tpl file) that hides the sidebar when that page type is selected. That way I can have some pages that show the sidebar and some that don't.
Thoughts?
Posted: Tue Oct 24, 2006 8:11 pm
by jshatch
Okay, so I hacked this together but it is far from optimal...
Since I don't ever use the "Pre-content" area of a static page, I added this if statement in the index.tpl of the theme I'm using:
Code: Select all
{if $staticpage_precontent != '<!--nosidebar-->'}
{if $rightSidebarElements > 0}
<td id="RightSideBar" valign="top">{serendipity_printSidebar side="right"}</td>
{/if}
{/if}
Now all I need to do is put '<!--nosidebar-->' in the Pre-content field and it doesn't display the sidebar.
Not an optimal solution by any means but it lets me choose what pages do and don't have the sidebar.
Posted: Tue Oct 24, 2006 8:34 pm
by garvinhicking
Hi!
Nice hack! Does the thing quite nicely.
To enlighten you about the g2embed plugin (great you found that, I didn't know it was doing this!), it uses this code:
Code: Select all
case 'frontend_generate_plugins':
if ($this->selected()) {
$eventData = array();
}
}
The frontend_generate_plugins hook passes the list of created sidebar items to an event plugin, and the event plugin modifies the stack to an empty array, which effectively does not print any sidebar items then.
Maybe this helps you somehow?
Best regards,
Garvin