how to hide the whole sidebar ?

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

Post 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
# 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/
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Thanks again Garvin, I'll give it a go.
75% of people make up three quarters of the World's population!
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post 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}
        
75% of people make up three quarters of the World's population!
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post 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%.
Judebert
---
Website | Wishlist | PayPal
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Thanks Judebert
This looks good. I'll try it and let you know how I get on.
75% of people make up three quarters of the World's population!
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post 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
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Good suggestion d_cee however I only want full width on the one page.
75% of people make up three quarters of the World's population!
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post 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
75% of people make up three quarters of the World's population!
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Post 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
Post Reply