We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26115
    • 15 Posts
    Hello,
    this is my first menu. It is a horizontal menu with images for first level.I have tried many examples but with no results. I am aware that time is a problem for everyone...
    I have made a menu which HTML code for two horizontal image buttons are:

    <div class="menu-main">
    <ul><li>
    <a href="#"><img src="assets/template/images/m_1_off.gif" class="roll"></a>
    <ul>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a> <ul><li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a>
    <ul><li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    </ul>
    </li></ul>
    </li></ul>
    </li>
    <li><a href="#"><img src="assets/template/images/m_2_off.gif" class="roll"></a>
    <ul>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a>
    <ul><li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a>
    <ul><li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    <li><a href="">submenu</a></li>
    </ul>
    </li></ul>
    </li></ul>
    </li>
    </li></ul>
    </div>

    Having only this simple HTML code and css is working fine. But I am having troubles with chunks and the snippet call. I don’t know how to integrate this code. Could someone suggest me the right solution?

    Thanks

    Sandra
      • 7231
      • 4,205 Posts
      You need to have a custom outerTpl, rowTpl, innerTpl and innerRowTpl. This is not tested but the following tpls should get you started.

      If you havent already check out the parameter section of the official docs for a complete list of possibilities:
      http://www.muddydogpaws.com/development/wayfinder/parameters.html

      outerTpl:
      <div class="menu-main">
      <ul>
          [+wf.wrapper+]
      </ul>
      </div> 


      rowTpl:
      <li><a href="[+wf.link+]"><img src="assets/template/images/m_[+wf.docid+]_off.gif" class="roll"></a>
          [+wf.wrapper+]
      </li>
      Note that I used [+wf.docid+] to add a unique number based on the document id. This is the standard way of cetting unique ids.

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


      innerRowTpl:
      <li[+wf.classes+]>
      	<a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>
      	[+wf.wrapper+]
      </li>


      You need a custom set of innerTpls since if blank wayfinder uses the outer and row as the default.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 26115
        • 15 Posts
        Thank you really very much for your help.

        I am very happy that my first menu is working tanks to you.

        laugh

        Sandra
          • 32830
          • 21 Posts
          Can someone tell me where to place the code for these templates: outerTpl, rowTpl, InnerTpl, etc?
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Those are "chunks". Just create a new chunk for each of them. You can name them what you please, just make sure to use exactly the same name in your Wayfinder snippet call’s parameters.
              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
              • 32830
              • 21 Posts
              Oh, duh - thanks for answering my newb question.
              I just tried it - it worked!