We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37234
    • 44 Posts
    Hello, I am using MODX Revolution MODX Revolution 2.1.3-pl and an trying to configure Wayfinder to wrap <span> tags inside the menu.

    Currently the menu outputs this:
    <ul>
    <li>Menu 1<li>
    <li>Menu 2<li>
    </ul>


    I want the menu to output this:

    <ul>
    <li><span>Menu 1</span><li>
    <li><span>Menu 2</span><li>
    </ul>



    I found an article and read the documentation and I created a snippet called "wrapspan" that looks like this:
    <li[+wf.classes+]><span>[+wf.linktext+]</span>[+wf.wrapper+]</li>


    Then in my Wayfinder tag I modified it to look like this:
    [[Wayfinder? &startId=`0`&hereTpl=`wrapspan`]] 


    Now my HTML is outputting this:
    <ul>
    <li[+wf.classes+]><span>[+wf.linktext+]</span>[+wf.wrapper+]</li>
    <li><span>Menu 1</span><li>
    <li><span>Menu 2</span><li>
    </ul>


    It looks like the snippet is not parsing the code and is just outputting it as text? Should I not be using a snippet? Am i using the wrong variable call in Wayfinder (&hereTpl) when I should be using another tag?

    This question has been answered by ottogal. See the first response.

      • 22427
      • 793 Posts
      To be precise in MODX terminology, your "wrapspan" is not a snippet but a chunk...

      If you want to have all your menu items wrapped by the span tags you have to assign this chunk to the parameter &rowTpl, not to &hereTpl. The latter only affects the active document and its ancestors in the resources tree.
        • 37234
        • 44 Posts
        ah yes I meant to say chunk. I've made the changes and added rowTpl instead.

        The menu is now looping properly, but it looks like its not parsing the variables and just printing them as text in the HTML

        This is the actual HTML in the source code:
        <li[+wf.classes+]><span>[+wf.linktext+]</span>[+wf.wrapper+]</li>
        <li[+wf.classes+]><span>[+wf.linktext+]</span>[+wf.wrapper+]</li>
        <li[+wf.classes+]><span>[+wf.linktext+]</span>[+wf.wrapper+]</li>

        Why isnt this tag in the chunk "[+wf.linktext+]" printing "Menu 1", "Menu 2", etc.? Am I using the right syntax/brackets/etc?? ie- [+XYZ+]
        • discuss.answer
          • 22427
          • 793 Posts
          That is the point (I overlooked it): The Revo syntax is a bit different, it should be
          <li[[++wf.classes]]><span>[[++wf.linktext]]</span>[[++wf.wrapper]]</li>

          For an overview see here:
          http://rtfm.modx.com/display/revolution20/Tag+Syntax
            • 37234
            • 44 Posts
            Perfect, that was easy enough. Thank you!