We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14786
    • 57 Posts
    Using latest version of modx just downloaded with default settings to everything.

    I have a chunk with the following snippet call
    [[navigation_active? &page=`clients` &alias=`[*alias*]`]]

    This is intended to pass back an "active" tab to the menu navigation that would be used to highlight the current page in the Nav. So the image tag is being used in the chunk like:
    img src="images/navigation[[navigation_active? &page=`clients` &alias=`[*alias*]`]]_clients.gif"

    Which when on the "clients" page the alias would be "clients" causing the snippet to return "_active" and the nav image would be highlighted.

    Snippet code:

    <?php
    
    if($alias == $page)
    return '_active';
    else
    return '';
    ?>


    For some reason passing the alias like that in the snippet causes the qualifier ($alias == $page) to fail. When I output both $alias and $page they are identical, I even used function gettype() and it says they’re both strings. They are identical I checked for extra spaces and everything but the if statement fails???

    I changed the snippet to do the following and this works:
    <?php
    $doc = $modx->getDocument($modx->documentIdentifier);
    if($doc['alias'] == $page)
    return '_active';
    else
    return '';
    ?>
      • 4310
      • 2,310 Posts
      Couldn’t you use the class="active" tag available through Wayfinder and then style via CSS?