Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Active class in menu
 
Dovoda
Jr. Member
 
Total Posts:  7
Joined:  2012-02-15
 

Ik heb handmatig een page in het menu geplaatst. De link werkt goed, maar als ik op de pagina ben is in het menu nog steeds de Home button ‘active’. Dus met een active kleurtje.

Ik heb de volgende code in top.phtml

<?php $_menu $this->renderCategoriesMenuHtml(0,'level-top'?>
<?php 
if($_menu): ?>
<div class="nav-container">
    <
ul id="nav">
       
       
        <!-- 
HOME BUTTON -->
        
<?php $_anyActive false; foreach ($this->getStoreCategories() as $_category{ $_anyActive $_anyActive || $this->isCategoryActive($_category); } ?>
        
<li class="<?php echo !$_anyActive ? 'active' : '' ?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home'?></a></li>
        <!-- 
HOME BUTTON -->
       
        <!-- 
PAGE-->
        <
li><a href="<?php echo $this->getUrl('eigen-pagina')?>">Eigen Pagina</a></li>
        <!-- 
PAGE-->
 
        
<?php echo $_menu?>
       
    
</ul>
</
div>
<?php endif ?>

Hoe krijg ik dus de ‘Eigen Pagina’ in de ‘active class’.
Let wel op: ik ben niet gevorderd wat betreft codes. Zeker geen PHP codes.

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedziner
Sr. Member
 
Avatar
Total Posts:  246
Joined:  2009-09-02
 

Give a try with this link : http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/add_home_link_to_menu_bar

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dovoda
Jr. Member
 
Total Posts:  7
Joined:  2012-02-15
 

No, it doesnt work with the Adding non-home links with active classes

Same problem. On ‘Custom Page’ the Home button has an active color.

<ul id="nav">
                
       <!-- 
HOME BUTTON HACK -->
        
<?php $_anyActive false; foreach ($this->getStoreCategories() as $_category{ $_anyActive $_anyActive || $this->isCategoryActive($_category); } ?>
        
<li class="<?php echo !$_anyActive ? 'active' : '' ?>"><a href="<?php echo $this->getUrl('')?>"><?php echo $this->__('Home'?></a></li>
        <!-- 
HOME BUTTON HACK -->
        
        <!-- 
CUSTOM PAGE-->
        <
li class="level0 nav-98 parent <?php if (strpos(Mage::helper('core/url')->getCurrentUrl(),'CMS-PAGE-PATH') != false ) :?> active<?php endif;?>">
        
        <
a href="<?php echo $this->getUrl('custom-page')?>"><?php echo $this->__(Custom Page')  ?></a>
        </li>
        <!-- END CUSTOM PAGE-->
 
        <?php echo $_menu; ?>
        
    </ul>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top