1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Docs] Hiding the Sidebar

Discussion in 'Design and Layout' started by Nick, Nov 8, 2009.

  1. Nick

    Nick Well-Known Member

    In some cases, you may wish to hide the sidebar from view.

    The Hotaru object has a sidebars property which is either true or false. You can change the value like this:

    Open /content/themes/YOUR_THEME/index.php and put this right at the top, just before <!-- HEADER --> :

    PHP:
    <?php $h->sidebars false?>
    That will hide the sidebar in the default theme.

    It will only work if your theme's index.php file includes the ability to hide the sidebar, like the default theme does.

    Of course, you don't want to hide the sidebar for every page, so you'll need to include a condition. For example, if you want to hide the sidebar on the login page, do this:

    PHP:
    <?php if ($h->pageName == 'login') {
        
    $h->sidebars false;
    ?>
    If you want to hide the sidebar on both the login and register pages, you might do this:

    PHP:
    <?php if (($h->pageName == 'login') || $h->pageName == 'register')) {
        
    $hotaru->sidebars false;
    ?>
    If there are more pages you want to hide the sidebar on, the best way is with a switch statement, like this:

    PHP:
    <?php switch ($h->pageName) {
        case 
    'login':
        case 
    'register':
        case 
    'account':
        case 
    'comments':
            
    $h->sidebars false;
            break;
        default:
            
    $h->sidebars true;
    ?>
     
    Last edited: Jan 7, 2010

Share This Page