We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22897 ☆ A M B ☆
    • 209 Posts
    I’m using WayFinder to generate a second-level navigation menu. The snippet is embedded in a chunk called ’PageFooter’ which is included in every template.

    For most pages the "sort by menuindex" works perfectly, however for certain sections I need to sort by pagetitle instead. Is there a mechanism to set variables in (for example) a template? For example
    Template file...
    [[SetVar &name=`sortorder` &value=`pagetitle`]]
    {{PageFooter}}
    
    
    // In chunk PageFooter
    [!Wayfinder? &startId=`[[UltimateParent? &topLevel=`1`]]` &hideSubMenus=`TRUE` &displayStart=`TRUE` &outerTpl=`sidebar.outerTpl` &sortBy=`[*sortorder*]` &rowTpl=`main.rowTpl` &innerTpl=`main.innerTpl` &startItemTpl=`sidebar.startItemTpl`!]


    The alternative is to embed the Wayfinder call into my templates, but that violates DRY smiley
      MAPLEDESIGN MODX development and MODX web design and custom development. Proud to serve UK and International clients!
      • 22303 MODX Staff
      • 10,725 Posts
      Put the call to the chunk inside a template variable. Then you can use @INHERIT and top-level folder specific values throughout your pages, or completely customize it within a specific document or node.

      [*page-footer*]

      would contain
      {{PageFooterA}}

      or
      {{PageFooterB}}

      or whatever content you wanted to customize for a particular branch or leaf of your document tree.