We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37437
    • 147 Posts
    I am working with Rev 2.2 and trying to use the IF snippet with Wayfinder in order to create a menu item that is non-clickable. (The menu item is not a parent, so I was not able to simply use the '&categoryFoldersTpl' parameter in order to try and accomplish what I need here.)

    Anyway, I can not seem to get the IF snippet to implement properly. I have been placing the snippet notation directly into the Wayfinder template that targets the menu item in question. This is the template code:

    <li[[+wf.classes]]>[[!If? &subject=`[[*id]]`&operator=`NEQ` &operand=`4` &then=`
    <a href="[[+wf.link]]">[[+wf.linktext]]</a>`
    &else=`[[+wf.linktext]]`]]
    [[+wf.wrapper]]
    </li>


    Can anyone tell me why the resource (its ID is '4') is still clickable in the menu? I am at my wits end here.

    Thanks much.
      • 22427
      • 793 Posts
      Did you try
      &subject=`[[+id]]`
      instead of
      &subject=`[[*id]]`
      ?
        • 33968
        • 863 Posts
        Try with an output filter:
        <li[[+wf.classes]]>[[+wf.docid:is=`4`:then=`[[+wf.linktext]]`:else=`<a href="[[+wf.link]]">[[+wf.linktext]]</a>`]]
        [[+wf.wrapper]]
        </li>
        


        http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29
          • 37437
          • 147 Posts
          Thanks much guys: problem seems to be solved. I initially tried ottogal's suggestion, and this took care of the link. The problem was that once the link was removed, I could no longer style the 'li' with css; the menu item was simply not picking up the style that I had defined for it (li#item4).

          Anyway, I then tried Lucas' suggestion, and that worked like a charm: the link was removed and I was able to style the LI left behind.

          Now, why do you think I was having such trouble with the IF snippet? Are there known bugs with this snippet?

          Thanks much for all the help.
            • 33968
            • 863 Posts
            No probs - I think if anything, the issue may be in calling a snippet inside a Wayfinder chunk rather than with the If snippet.
              • 37437
              • 147 Posts
              Thanks Lucas. Do you think there might be another way to implement the If snippet with Wayfinder? Also, is the If snippet redundant given that there are output filters in Rev?
                • 33968
                • 863 Posts
                Redundant smiley
                • Actually, there are cases the if snippet would be more appropriate than an output modifier... I like OMs more tho tongue
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.