Page 1 of 1

Different designs for sidebar blocks

Posted: Tue May 17, 2011 6:13 pm
by LazyBadger
Are there any way to detect in which sidebar block must be output'ed (inside theme)? For strange reason I want to get differently decorated blocks in left and right sidebar, but - see only one sidebar.tpl

Re: Different designs for sidebar blocks

Posted: Tue May 17, 2011 6:27 pm
by Don Chambers
In templates/default/index.tpl, you can see an example like this:

Code: Select all

<table id="mainpane">
    <tr>
{if $leftSidebarElements > 0}
        <td id="serendipityLeftSideBar" valign="top">{serendipity_printSidebar side="left"}</td>
{/if}
        <td id="content" valign="top">{$CONTENT}</td>
{if $rightSidebarElements > 0}
        <td id="serendipityRightSideBar" valign="top">{serendipity_printSidebar side="right"}</td>
{/if}
    </tr>
</table>
So, using css, you can style each sidebar differently with #serendipityLeftSideBar, and #serendipityRightSideBar....

Each of the above will use sidebar.tpl from your template, if it exists, or /templates/default/sidebar.tpl if it does not.

If you want to call a unique smarty tpl, you can do that like this:

Code: Select all

{serendipity_printSidebar side="right" template="my_unique_sidebar.tpl"}