Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • socoweb Friend
    #138708

    I want to hide the left column on only the home page. From my research and prior experience, this should work with the highlighted code, but it doesn’t seem to.

    The following lines are from the JA Mageia template, additions in red

    <!– hide left col for home page –>
    <?php if (strtolower($option) != ‘com_frontpage’) { ?>

    <?php if ($this->countModules(‘left’)) { ?>
    <!– BEGIN: LEFT COLUMN –>
    <div id=”ja-col1″>
    <div class=”ja-innerpad”>
    <?php if ($JAconfig->ja_menutype == 1 && $jamenu->hasSubMenu (1)) {
    echo ‘<div id=”ja-subnavcol” class=”moduletable”>’;
    echo ‘<h3>’.$jamenu->getParentText (1).'</h3>’;
    $jamenu->genMenu (1);
    echo ‘</div>’;
    } ?>
    <jdoc:include type=”modules” name=”left” style=”xhtml” />
    </div>
    </div><br />
    <!– END: LEFT COLUMN –>
    <?php } ?>

    <!– END: hide left column –>
    <?php } ?>

    The reason for this is so that that modules assigned to the left column can be assigned to all pages in the site, and not display the column on the home page. it makes it easier to manage the modules

    Thanks for your help.

    Anonymous Moderator
    #295167

    Hi socoweb,

    i think this is not the best way.
    In administrator, you edit each module which is displaying at the left position, change the Menu Assignment, don’t select the Home item.

    Hope it helps.

    scotty Friend
    #295182

    Instead of using com_frontpage I would use the Home link.

    [php]<?php $menu = &JSite::getMenu(); ?>
    <?php if ($menu->getActive() == $menu->getDefault()) { ?>
    do something
    <?php } else { ?>
    do something else
    <?php } ?>[/php]Or you could change the == to != and then it would do the condition only if you were NOT on the frontpage. This way you only need one condition and you can use ENDIF instead of placing a second condition.

    I’ll do it out properly for Senecio tonight.

    socoweb Friend
    #307667

    Thank you for that excellent bit of PHP code, it helped me do exactly what I want to do, create conditional a pathway and menu columns that appear only when the user is past the home page. It auto collapses the DIV tags

    The benefit to this is that clients do not get confused when they create new content items, and forget to activate modules for the new menu items that correspond to the pages they link to. I can leave all left modules set to appear on all pages, and not have to worry about turning them on or off.

    Benefits:

    • The pathway doesn’t appear on the home page
    • I created a new content area for the left menu above the left column, which conditionally hides if the user is on the home page even if a menu is published to it.
    • The left column appears only if items are published to it on the home page

    Note:code from JA Nickel, required a modification to the file ja_vars_1.5.php as such:

    # Auto Collapse Divs Functions ##########
    # ja_leftmenu Added for conditional left menu!!###
    $ja_leftmenu = $this->countModules('leftmenu');
    $ja_left = $this->countModules('left');
    $ja_right = $this->countModules('right');
    if ($tmpTools->isContentEdit()) {
    $ja_right = $ja_left = 0;
    }
    if ( $ja_left || $ja_leftmenu && $ja_right ) {
    $divid = '';
    } elseif ( $ja_left ) {
    $divid = '-fr';
    } elseif ( $ja_leftmenu ) {
    $divid = '-fr';
    } elseif ( $ja_right ) {
    $divid = '-fl';
    } else {
    $divid = '-f';
    }

    Code for index.php:

    <?php $menu = &JSite::getMenu(); ?>
    <?php if ($menu->getActive() == $menu->getDefault()) { ?>
    <?php if ( $ja_left) { ?>
    <!-- Left COLUMN -->
    <div id="ja-col1">
    <div class="ja-innerpad">
    <jdoc:include type="modules" name="left" style="jamodule" />
    </div>
    </div>
    <!-- //Left COLUMN -->
    <?php } ?>

    <?php } else { ?>

    <div id="ja-pathway" class="wrap">
    <div class="main">
    <div class="ja-pathway-text">
    <strong>You are here:</strong><jdoc:include type="module" name="breadcrumbs" />
    </div>
    </div>
    </div>

    <!-- check ja_vars-->
    <?php if ( $ja_left || $ja_leftmenu) { ?>
    <!-- Left COLUMN -->
    <div id="ja-col1">

    <?php if ($this->countModules('leftmenu')||('left')) { ?>
    <!-- Left MENU -->
    <div id="ja-leftmenu">
    <div class="ja-innerpad">
    <jdoc:include type="modules" name="leftmenu" style="jamodule" />
    </div>
    </div>
    <?php } ?>
    <jdoc:include type="modules" name="left" style="jamodule" />
    </div>
    <!-- //Left COLUMN -->
    <?php } ?>
    <?php } ?>

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 3 voices, and was last updated by  socoweb 15 years, 5 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum