We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3677
    • 130 Posts
    In general, all of my modx chunks use an include to bring in the html from an external file.
    I’ve got Wayfinder working ok when the chunks are setup with html directly in modx manager. If I externalize the same code and use an include in the modx chunk then it won’t work.

    Is this expected?

    Thanks,
    -Brian
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can use an external file for Wayfinder’s configuration, thus moving all the parameters into PHP variables with only the &config=`filename` parameter in the snippet call. This is a plain .php file, so the tpls’ HTML code can be defined directly in that file.
      $rowTpl = '<li> ... </li>';
      

      I don’t know the answer to your actual question.
        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
        • 3749
        • 24,544 Posts
        I don’t understand your question. Chunks can’t contain PHP code so how are you "including" the contents of the files in the chunks?

        And what’s the relationship between Wayfinder and the chunks? Are they Tpl chunks set in the Wayfinder tag?
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Chunks used as a tpl for a snippet like Wayfinder are not initially processed; Wayfinder simply takes the content of the chunk and applies it to each item it retrieves, replacing the placeholders with the values for each item as it works through the loop. Any snippet tags would simply be inserted as-is for each item, and wouldn’t get processed until the next pass of the whole document through the parser.

          On the first pass you’d get a menu consisting of the snippet tags for each menu item, then on the next pass the snippet would get replaced with the included files, but the placeholders wouldn’t have any meaning since the Wayfinder snippet isn’t in play any more.
            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