We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33657
    • 128 Posts
    is it possible to do this?

    [[+tv.myvar:is=`1`:then=`myvar is one`:else=`myvar is not one`]]

    is there a way to do multiple conditionals? like

    if myar is 1 = this
    else if my var is 2 = that
    else if my var is 3 = whatever
    else = final

    the reason I ask is I am building a complex wayfinder menu that I want to have variables for the type of dropdown, i am setting a template variable called dropDownType, in that dropDownType i have dropdown / slidedown / etc

    I want to load different wayfinder row’s based on that variable. to make a long story short, I am able to do it on only 2 variables. if and else but i would love to do if elseif else or even more...

    i even tried to do if / else and in the else i send it to a chunk, and then in my chunk i am doing another if else but the chunk doesn’t seem to get wayfinder values... almost like its out of scope at that point.

    any ideas?

    I also tried to stack it like this

    if myvar = 1 = do something else = ’’ (blank) then directly under i do another one
    if myvar = 2 = do something different else = ’’’


      • 33657
      • 128 Posts
      ok i just tried it again and basically it works as long as I don’t include a wayfinder variable in multiple filters. so really i need a way to do elseif on a filter.
        • 22427
        • 793 Posts
        Perhaps the snippet [tt]Switch[/tt] might help?
        http://modx.com/extras/package/switch
          • 33657
          • 128 Posts
          Thanks! that did the trick! worked like a charm!

          I wonder how much of a performance hit I will take running wayfinder and doing a switch command on each row. might not be that great of a idea? smiley at least it works.