Question

I am not sure if this is possible so i thought i would ask as all my attempts have not worked so far. I have a top navigation where i have tabs "All Categories" , "consumable", "Furniture" etc. However i want the All categories tab to be full extended only on the home page but not on any other page. Is this possible, if so how would i go about it?

This is my code which i believe is creating my "All Categories" tab as it is in my top.phtml

<?php $_menu = $this->renderCategoriesMenuHtml(0, 'level-top', 'sub-wrapper' ) ?>
<?php if($_menu): ?>
<div class="nav-container">
    <div class="nav-top-title"><div class="icon"><span></span><span></span><span></span></div><a href="#">
    <?php echo $this->__('Navigation'); ?></a></div>
    <ul id="mdmsNav">
        <?php if (Mage::getStoreConfig('midmedssettings/navigation/home')): ?>
         <li class="level0 level-top">
            <a href="<?php echo $this->getBaseUrl(); ?>"><span><?php echo $this->__('Home'); ?></span></a>
         </li>
     <?php endif; ?>

If i haven't explained myself very well please let me know or if you need more code just add a comment.

Thank you

Était-ce utile?

La solution

Here are 2 ways to check if the page you are on is the Homepage:

if($this->getIsHomePage()) {
    echo 'You are in Homepage!';
} else {
    echo 'You are NOT in Homepage!';
}

and

$routeName = Mage::app()->getRequest()->getRouteName();
$identifier = Mage::getSingleton('cms/page')->getIdentifier();

if($routeName == 'cms' && $identifier == 'home') {
    echo 'You are in Homepage!';
} else {
    echo 'You are NOT in Homepage!';
}

from here.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top