We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9496
    • 113 Posts
    I think there are a couple of ways ou could do this. If that menu is only on the "about page" then you could simply use [*pagetitle*] snippet, but if you click on the link contained within that then obviously it wold change the heading.

    I think that a better way may be to set the site up so about becomes a container (or folder, not quite sure on the terminology, yet) and make that the parent of the sub entries. Then you could use a getParent snippet which wuold essentialy display the parents title.

    It would wourk something like this...

    In your manager you would have:

    About
    -->article 1
    -->article 2
    -->article 3

    With the "about" page being its parent Then have the getParent snippet:
    <?php
    $getParent = $modx->getParent($id,1,'pagetitle');
    return $getParent["pagetitle"];
    ?>


    Then in your template you would have:
    <h2>[[getParent]]</h2>
    [!Wayfinder? &startId=`[[UltimateParent? &id=`[*id*]` &topLevel=`1`]]` &hideSubMenus=`0` &outerTpl=`sub_wfOuter` &rowTpl=`sub_wfRow` &hereClass=`active` &displayStart=`1` &startItemTpl=`subHeader` !]


    But for the main category page template:
    <h2>[*pagetitle*]</h2>
    [!Wayfinder? &startId=`[[UltimateParent? &id=`[*id*]` &topLevel=`1`]]` &hideSubMenus=`0` &outerTpl=`sub_wfOuter` &rowTpl=`sub_wfRow` &hereClass=`active` &displayStart=`1` &startItemTpl=`subHeader` !]


    Simply so it doesn’t call its parent.

    I would also venture to guess that it could be accomplished via one snippet and chunk, but you would have to do some comparisons within the snippet and pass the id to it.
    Something like:
    if the id == (whatever the id of the parent is) then return the pagetitle of that doc, else if the parent id == getParent ID then print it’s parents pagetitle.
    Something like that would check to see if its a parent or a child and return the appropriate heading. depending on its location within the tree.

    Or you could simply add a tv (or tag) with the appropriate header and return that as well.

    So a tv called somethng like "category" would have a list like
    -->About
    -->Events
    etc...and when you make an entry just select the appropriate section then call it from your template:

    <h2>[*category*]</h2>

    WHich is an extra entry but it gives you an extra handle to work with and may be easier than writing up the snippet.
    -P