We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18668
    • 25 Posts
    Firstly, really liking MODx, fantastic CMS, will definitely be using this more in the future!

    However, I’ve come across a problem.  I’m trying to tweak the ListMenuX snippet so that it doesn’t show pages that are set not to show up in the menu (with the "Show in menu" check box).  Those of you who are familiar with this snippet may recognise this bit of code:

    // If child is current document, add activeLink class
    if ($child['id']==$modx->documentIdentifier)
    { 
    $menu .= "<li$sLiClass><a$sActiveLinkClass href='[~".$child['id']."~]' title='".$child['description']."'>".$child['pagetitle']."</a>";
    } 
    else
    {
    $menu .= "<li$sLiClass><a href='[~".$child['id']."~]' title='".$child['description']."'>".$child['pagetitle']."</a>";
    }
    


    I’ve added in an extra condition on the else clause:

    else if ($child['hidemenu']==0)


    This, from what I’ve read, should make sure that only pages that are set to be shown in the menu actually appear in the menu.  So far, this hasn’t been working.  I even put a little debug line in there so that it printed out in the link what the child’s hidemenu value was, but this came up blank.  Am I doing something wrong here? Any helpful insights would be very much appreciated!  Just for reference, below is the code I’ve got at the moment:

    // If child is current document, add activeLink class
    if ($child['id']==$modx->documentIdentifier)
    { 
    $menu .= "<li$sLiClass><a$sActiveLinkClass href='[~".$child['id']."~]' title='".$child['description']."'>".$child['pagetitle']."</a>";
    } 
    // If child IS to be shown in menu
    else if ($child['hidemenu']==0)
    {
    $menu .= "<li$sLiClass><a href='[~".$child['id']."~]' title='".$child['description']."'>".$child['pagetitle']." - ".$child['hidemenu']."</a>";
    }
    
      ******************
      Matthew Dawkins
      www.matthewdawkins.co.uk
      We make web sites for churches
      Follow me on Twitter: twitter.com/chapter9
      ******************
    • I’m afraid nobody much uses ListMenuX any more, it’s been pretty much replaced by DropMenu.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • Yes, ListMenuX was authored before the hidemenu feature was added to MODx. DropMenu does much of the same things, but is more recent and takes advantage of all the latest features, including Show in Menu.