We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17510
    • 16 Posts
    Hi,

    I have a navigation generated by Wayfinder

    [!Wayfinder?&startId=`0`&level=`2`&outerTpl=`mh.OuterTpl` &innerTpl=`mh.InnerTpl` &rowTpl=`mh.RowTpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=`hereclass`!]

    it shows the menu and submenu in dropdowns... the problem is that I need to remove the link from top level menu which has children

    How’s better to solve this problem ?

    for example I have:

    Home
    Products
    Product one
    Product two
    Product three
    About Us
    Page one
    Page two
    Page three
    Contact Us

    I need to link Products and About Us to "#", now it links to the page ID. Other submenus links should not be changed. Also home and Contact us should stay the same. The link should be replaced with # only on parents who has active children.
      • 16183
      • 1,390 Posts
      You could use the &parentRowTpl

      &parentRowTpl
      default value: NULL
      values: name of template chunk
      description: The parentRowTpl template is used when processing items that are folders with their children being displayed in the menu.
      available placeholders: Same as RowTpl.
      example:
      <li[+wf.classes+]>
      <a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>
      [+wf.wrapper+]
      </li> 


      What creates the link is the [+wf.link+]. So, you can try to either remove it and there won’t be any link, or if you specifically want a dummy link #, replace [+wf.link+] with # So.....

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


      Haven’t tested it yet, but I think it should work.
      Tested and it works. However, on click, the dummy link redirects to the home page. You could probably use javascript to make it void. e.g.

      javascript:void(null)
      e.g. <a href="javascript:void(null)">this link goes nowhere</a>


      There’s probably a better way of doing this, maybe using an onclick event. I’ll let those who know chip in.

      cheers/k
        • 17510
        • 16 Posts
        seems to be the right solution, I’ve added needed options but it doesn’t change anything, very strange.
          • 17510
          • 16 Posts
          I’ve created prow chunk, with code

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

          and my wayfinder call looks like

          [!Wayfinder?&startId=`0`&level=`2` &parentRowTpl=`prow` &outerTpl=`mh.OuterTpl` &innerTpl=`mh.InnerTpl` &rowTpl=`mh.RowTpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=`hereclass`!]

          is it correct ? :-|
            • 17510
            • 16 Posts
            OMG, it worked, thank you very much smiley
              • 16183
              • 1,390 Posts
              That looks correct, so ye, strange. You made sure you are referencing the correct chunk, no typos? Clearing the cache should not be an issue in this case, but have you tried that? Are you calling Wayfinder in a rich text editor environment? If so, can you confirm your RTE is not mangling the WF code?

              cheers/k
                • 16183
                • 1,390 Posts
                Quote from: Loter at Aug 21, 2009, 03:36 AM

                OMG, it worked, thank you very much smiley

                Aaah, brilliant! laugh So what was the problem then? Glad it worked. How did you deal with the dummy link getting redirected, btw? Please modify this thread’s title to show the issue has been resolved. Thx.

                cheers/k
                  • 17510
                  • 16 Posts
                  the problem was somewhere inside the chunk, just recreated and changed names, cleared cache and it started working

                  brilliant, tons of thanks
                    • 16183
                    • 1,390 Posts
                    Ok, welcome...

                    cheers/k
                      • 30598
                      • 14 Posts
                      Quote from: kongondo at Aug 21, 2009, 03:40 AM

                      Quote from: Loter at Aug 21, 2009, 03:36 AM

                      OMG, it worked, thank you very much smiley

                      How did you deal with the dummy link getting redirected, btw? Please modify this thread’s title to show the issue has been resolved. Thx.

                      cheers/k

                      I’ve found this is still the case in my attempt to try this. If you’re on any page other than home and you click on the link with the href="#" - it appears to be reading an absolute link of www.mysite.com/# and takes you home. Is there a way in MODx to force it [Wayfinder] to use relative linking ?? Other wise I may try that javascript you posted.

                      Thanks!