Page 2 of 2

Posted: Mon Oct 13, 2008 4:48 pm
by garvinhicking
Hi!

Ah, in that case your CSS / DIV-Layout must be made so that the extra sidebars do not emit their own containers.

The bulletproof template does not pay attention whether a sidebar is empty or not. It always emits the surrounding HTML. So you need to either use a template that supports filling up the whole area when no sidebar elements are pressent, or you need to modify the bulletproof index.tpl some more.

Let's take the first occurence of the printSidebar in BP's index.tpl for example:

Code: Select all

       {if $template_option.layouttype == '3sbs'}
            <!-- case 1: 3 columns, sidebar-content-sidebar -->
            <div id="serendipityLeftSideBar" class="threeside layout3sbs_left">
                {if $template_option.sitenavpos == 'left'}
                    <!-- #sbsitenav: like #sitenav, but placed within the sidebar                    -->
                    <div id="sbsitenav" class="serendipitySideBarItem">
                        <h3 class="serendipitySideBarTitle">{$template_option.sitenav_sidebar_title}</h3>
                        <div class="serendipitySideBarContent">
                            <!-- the line below must remain as a single uninterrupted line to display correctly in ie6 -->
                            <ul>{foreach from=$navlinks item="navlink" name="sbnav"}<li class="{if $currpage==$navlink.href}currentpage{/if}
                            {if $smarty.foreach.sbnav.first} sbnavlink_first{/if}{if $smarty.foreach.sbnav.last} sbnavlink_last{/if}">
                            <a href="{$navlink.href}" title="{$navlink.title}">{$navlink.title}</a></li>{/foreach}</ul>
                        </div>
                        <div class="serendipitySideBarFooter"></div>
                    </div>
                {/if}
                {if $leftSidebarElements > 0}{serendipity_printSidebar side="left"}{/if}
            </div>
As you might be able to see, the IF check for more than 0 sidebar elements comes rather late at the end. You would need to change it to something like this:

Code: Select all

       {if $template_option.layouttype == '3sbs' && $leftSidebarElements > 0}
            <!-- case 1: 3 columns, sidebar-content-sidebar -->
            <div id="serendipityLeftSideBar" class="threeside layout3sbs_left">
                {if $template_option.sitenavpos == 'left'}
                    <!-- #sbsitenav: like #sitenav, but placed within the sidebar                    -->
                    <div id="sbsitenav" class="serendipitySideBarItem">
                        <h3 class="serendipitySideBarTitle">{$template_option.sitenav_sidebar_title}</h3>
                        <div class="serendipitySideBarContent">
                            <!-- the line below must remain as a single uninterrupted line to display correctly in ie6 -->
                            <ul>{foreach from=$navlinks item="navlink" name="sbnav"}<li class="{if $currpage==$navlink.href}currentpage{/if}
                            {if $smarty.foreach.sbnav.first} sbnavlink_first{/if}{if $smarty.foreach.sbnav.last} sbnavlink_last{/if}">
                            <a href="{$navlink.href}" title="{$navlink.title}">{$navlink.title}</a></li>{/foreach}</ul>
                        </div>
                        <div class="serendipitySideBarFooter"></div>
                    </div>
                {/if}
                {serendipity_printSidebar side="left"}
            </div>
See how I moved the IF-Query to the top of that. So when no left sidebar elements are there, the whole block is not shown.

I don't understand the whole Layouttype methods of BP, so it might be more complex to use a placeholder div/class that instructs BP to not use up space for the sidebar. I believe only YellowLED, David or Don could offer a hand on that.


Regards,
Garvin

Posted: Mon Oct 13, 2008 5:08 pm
by Ianardo
Thanks again Garvin, I'll give it a go.

Posted: Mon Oct 13, 2008 5:40 pm
by Ianardo
Sorry to be a pain but I still can't get it to work!
This is the section I want to change:

Code: Select all

{if $template_option.layouttype == '2bs'}
            <!-- case 5: 2 columns, right sidebar only -->
            <div id="content" class="twomain layout2bs_content hfeed">
                {$CONTENT}
            </div>
            <div id="serendipityRightSideBar" class="twoside layout2bs_right">
                {if $template_option.sitenavpos == 'left' or $template_option.sitenavpos == 'right'}
                    <!-- #sbsitenav: like #sitenav, but placed within the sidebar                    -->
                    <div id="sbsitenav" class="serendipitySideBarItem">
                        <h3 class="serendipitySideBarTitle">{$template_option.sitenav_sidebar_title}</h3>
                        <div class="serendipitySideBarContent">
                            <!-- the line below must remain as a single uninterrupted line to display correctly in ie6 -->
                            <ul>{foreach from=$navlinks item="navlink" name="sbnav"}<li class="{if $currpage==$navlink.href}currentpage{/if}{if $smarty.foreach.sbnav.first} sbnavlink_first{/if}{if $smarty.foreach.sbnav.last} sbnavlink_last{/if}"><a href="{$navlink.href}" title="{$navlink.title}">{$navlink.title}</a></li>{/foreach}</ul>
                        </div>
                        <div class="serendipitySideBarFooter"></div>
                    </div>
                {/if}
                {if $leftSidebarElements > 0}{serendipity_printSidebar side="left"}{/if}
                {if $rightSidebarElements > 0}{serendipity_printSidebar side="right"}{/if}
            </div>
        {/if}
        

Posted: Mon Oct 13, 2008 6:21 pm
by judebert
I'm not so sure that this is going to work. It looks like one of the fixed-width template types. And you'll have to give up the capability to put the site navigation in the sidebar. Nevertheless, you can try this, and verify that the <div> with id serendipityRightSideBar is never printed:

Code: Select all

{if $template_option.layouttype == '2bs'}
            <!-- case 5: 2 columns, right sidebar only -->
            <div id="content" class="twomain layout2bs_content hfeed">
                {$CONTENT}
            </div>
            {if $leftSidebarElements > 0 || $rightSideBarElements > 0 }
            <div id="serendipityRightSideBar" class="twoside layout2bs_right">
                {if $template_option.sitenavpos == 'left' or $template_option.sitenavpos == 'right'}
                    <!-- #sbsitenav: like #sitenav, but placed within the sidebar                    -->
                    <div id="sbsitenav" class="serendipitySideBarItem">
                        <h3 class="serendipitySideBarTitle">{$template_option.sitenav_sidebar_title}</h3>
                        <div class="serendipitySideBarContent">
                            <!-- the line below must remain as a single uninterrupted line to display correctly in ie6 -->
                            <ul>{foreach from=$navlinks item="navlink" name="sbnav"}<li class="{if $currpage==$navlink.href}currentpage{/if}{if $smarty.foreach.sbnav.first} sbnavlink_first{/if}{if $smarty.foreach.sbnav.last} sbnavlink_last{/if}"><a href="{$navlink.href}" title="{$navlink.title}">{$navlink.title}</a></li>{/foreach}</ul>
                        </div>
                        <div class="serendipitySideBarFooter"></div>
                    </div>
                {/if}
                {if $leftSidebarElements > 0}{serendipity_printSidebar side="left"}{/if}
                {if $rightSidebarElements > 0}{serendipity_printSidebar side="right"}{/if}
            </div>
            {/if}
        {/if}
If you know for certain that you will never set the sidebar site navigation option, you can remove everyting from:

Code: Select all

{if $template_option.sitenavpos == 'left' or $template_option.sitenavpos == 'right'} 
to its {/if}, just above

Code: Select all

{if $leftSidebarElements > 0}{serendipity_printSidebar side="left"}{/if}
Finally, even if the HTML for the sidebar is gone, the main column will still only be 75% width. To change it, you'd need to look in the templates/bulletproof/ folder and find the base.css file containing the "width" attribute for the "twomain" class to 100%.

Posted: Mon Oct 13, 2008 7:40 pm
by Ianardo
Thanks Judebert
This looks good. I'll try it and let you know how I get on.

Posted: Tue Oct 14, 2008 11:37 am
by d_cee
Hi

maybe you could set the sidebar config to just one sidebar in bulletproof so that it puts the sidebar at the bottom and then you'll get the width you want.

Dave

Posted: Tue Oct 14, 2008 1:22 pm
by Ianardo
Good suggestion d_cee however I only want full width on the one page.

Posted: Tue Oct 14, 2008 5:11 pm
by Ianardo
Judebert, unfortunately your fix made all the pages full width and pushed the sidebar below right.

I think i'll give up now.
It's not the School that wants the change anyway, just me being picky.
Thanks Guys

Posted: Wed Oct 15, 2008 11:32 am
by d_cee
If you only want the width on one page can't you make that page a different category and use a duplicate template in a different configuration for that category? I'm not sure how this would work with a Static Page but I'm sure Garvin or Judebert would.

Dave