We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36536
    • 8 Posts
    Any way to carry the Wayfinder placeholders
    (wf.classes wf.wrapper etc.)
    to other chunks and snippets?

    Imagine the Wayfinder call was...

    [[!Wayfinder? 
      &startId=`0`
      &outerTpl=`chunk1`
    ]]
    


    Then the code for chunk1 is
    [[$chunk2]]


    Now, the code for chunk2 outputs the WF menu
    <ul[[+wf.classes]]>
    [[+wf.wrapper]]
    </ul>



    This code would fail correct? (it failed for me) Cause all the "wf" placeHolders doesn't "carry over" to the chunk2 ?

    Is there an easy way for 'wf' placeholders to pass to subsequent chunks&snippets?

    Thanks,
    Quang
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That won't work because the Wayfinder placeholders are created, processed and replaced within Wayfinder's code. They are not global MODx placeholders.
        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
        • 36424
        • 10 Posts
        hi,

        there would be a way to do this but it looks a bit complicated or heavy, well now, i don't know what you are trying to do, it may be justified

        in chunk1 you could call a snippet instead of a chunk, passing the wayfinder placehoders values as parameters, this snippet containing a $modx->parseChunk('chunk2', $params, '[+', '+]') with the wayfinder placehoders in $params, this would work even if, once more, it looks a bit like what we call in French a gas plant smiley

        have swing
          • 22303 MODX Staff
          • 10,725 Posts
          It should work fine so long as Wayfinder is using the proper API methods when processing the Chunks. The properties are set for the scope of processing of each Chunk, so anything processed inside the Chunk should be processed while those placeholders are still in scope. Once the processing of the top-level Chunk is done, those placeholders will be unset and any overridden restored.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Unless Wayfinder for Revo is radically different than for Evo it doesn't use API methods for handling its placeholders, it has its own internal placeholders array and processes its tpls internally.
              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
              • 36536
              • 8 Posts
              yeh doesn't seem to work...

              I actually wanted to use a static file for the outerTpl, so in my chunk1 I have something like (using Revo)

              [[include?file=`outerTpl.php`]]


              Hey, @virtual what did your snippet call look like from within chunk1 ? Couldn't really follow...

              Inside my static file, outerTpl.php would be the wayfinder template code.

              <ul[[+wf.classes]]>
              [[+wf.wrapper]]
              </ul>


              ... I decided to use @FILE:/my/path/outerTpl.php instead

              [[!Wayfinder? 
                &startId=`0`
                &outerTpl=`@FILE:/my/path/outerTpl.php`
              ]]


              Hey I noticed that there was no mention of @FILE (and @CODE, are there any more possible bindings?) in the updated Wayfinder Docs.

              http://rtfm.modx.com/display/ADDON/Wayfinder

              Is that the most updated Wayfinder docs? Is the @FILE binding codes being depreciated on Wayfinder?

              Thanks
                • 22427
                • 793 Posts
                Using the @FILE binding, the value of &outerTpl has to be a file containing HTML code, not a php file. So this can not work:
                &outerTpl=`@FILE:/my/path/outerTpl.php`
                Edit:
                Saw now that your file outerTpl.php does contain HTML code (so better change its name). [ed. note: ottogal last edited this post 15 years, 1 month ago.]
                  • 36536
                  • 8 Posts
                  lol, Thanks ottogal.

                  yeh those file-type are tricky... I'd imagine those files might be called outerTpl.php.html or something.