We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18250
    • 37 Posts
    Hello there...

    I’ve been reading and trying to find out a way to build a menu that could have a similar structure as this:

    <ul id="someMenu">
    <li id="menu1"><a id="menu1a">home</a></li>
    <li id="menu2"><a id="menu2a">home</a></li>
    <li id="menu3"><a id="menu3a">home</a></li>
    <li id="menu4"><a id="menu4a">home</a></li>
    </ul>
    

    Please don’t ask me why i need this id’s, i just do wink
    There is a way, that i figured it out, but it’s not very nice... I put into description field this id’s and put this into chunk:
    <li[+wf.classes+]  id="[+wf.description+]><a id="[+wf.description+]a" href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>
    


    But this method is not very clean, and i’d really like to know, if there is any other way..
    I’d rather see if that numbers weren’t Document Id’s...

    And also, i can hardly believe, that Wayfinder, isn’t making full use of MenuIndex field, which is actualy ment for menus. Or just i don’t know about it? I know, you can sort your menu according to that MenuIndex, but you cant actually use that number somwhere in your chunk....

    However, if someone has an idea, how that could be done, i’d really appreciate if you colud help...

    Thanks in advance. wink


      • 28042 ☆ A M B ☆
      • 24,524 Posts
      &rowIdPrefix=`whatever`

      Wayfinder will add the document’s ID to this, so you could have id="menu23" if you set it to `menu`.
        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
        • 7455
        • 2,204 Posts
        could you not us it like this?

        id="menu[+wf.menuindex+]a"

        But I tested it and indeed this field is not suported by Wayfinder.
        Feature request

        Dimmy
          follow me on twitter: @dimmy01
          • 11975
          • 2,542 Posts
          Hi,

          I’ve not tested it but in could work

          in wayfinder.inc.php

          change: line 21
          var $placeHolders = array(
          ’rowLevel’ => array(’[+wf.wrapper+]’,’[+wf.classes+]’,’[+wf.classnames+]’,’[+wf.link+]’,’[+wf.title+]’,’[+wf.linktext+]’,’[+wf.id+]’,’[+wf.attributes+]’,’[+wf.docid+]’,’[+wf.introtext+]’,’[+wf.description+]’,’[+wf.subitemcount+]’,’[+wf.menuindex+]’),
          ’wrapperLevel’ => array(’[+wf.wrapper+]’,’[+wf.classes+]’,’[+wf.classnames+]’),
          ’tvs’ => array(),
          );

          and line 181 (renderRow function)

          $phArray = array($useSub,$useClass,$classNames,$resource[’link’],$resource[’title’],$resource[’linktext’],$useId,$resource[’link_attributes’],$resource[’id’],$resource[’introtext’],$resource[’description’],$numChildren,$resource[’menuindex’]);

          :-)
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 7455
            • 2,204 Posts
            Nice that worked like a charm. Thanks a lot
              follow me on twitter: @dimmy01
              • 18250
              • 37 Posts
              You guys are the greatest. Thanks so much... smiley
                • 11429
                • 90 Posts
                how to add a < span > to the textoflink to go with the above scenario ?

                could you give an example for both the snippet call and also inside a chunk ?

                i want to hide the text and replace it with an image
                  • 2798
                  • 22 Posts
                  Use this for the rowTpl:

                  		<li class="menue[+wf.docid+]"><a title="[+wf.linktext+]" href="[+wf.link+]" [+wf.classes+]><span>[+wf.linktext+]</span></a>[+wf.wrapper+]</li>

                  The Wayfinder is in a div#navcontainer - defined in the template!

                  So then you use the following for example:
                  #navcontainer ul li.menue1 a { background-image: url(img/menu/first.png); width: 80px; background-repeat: no-repeat; }
                  #navcontainer ul li.menue1 a:hover, #navcontainer ul li.menue1 a.active { background-image: url(img/menu/first-r.png) }
                  /* for the first menubutton  */
                  
                  /* with this hidden-argument you can disable the text-links  */
                  #navcontainer ul li a span { display:none}


                  You need to surround the [+wf.linktext+]-tag from wayfinder with an hidden span-tag!!! that’s it.....
                    • 16495
                    • 3 Posts
                    Thank you, that was what I was looking for.