We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42901 ☆ A M B ☆
    • 73 Posts
    All of the sudden this code stopped working on 2.2.7 when calling a value of Yes/No from a TV.

    [[!If?
       &subject=`[[*resource]]`
       &operator=`EQ`
       &operand=`Yes`
       &then=`[[$someChunk]]`
       &else=`[[$someOtherChunk]]`
    ]]


    I was however able to make part of it work by doing this:

    [[*resource:is=`Yes`:then=`
      [[$someChunk]]
    `]]
    


    So, was something changed in 2.2.7 or am I taking crazy pills?!?!
      Woodlands Ad Agency
      Our blog should NOT be read by anyone....EVER http://woodlandsadagency.com/blog/
      ...Don't say we didn't warn you.
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: adagency at Apr 14, 2013, 11:16 AM
      So, was something changed in 2.2.7 or am I taking crazy pills?!?!
      Nothing was changed that I am aware of that would make this stop working... ?
        • 42901 ☆ A M B ☆
        • 73 Posts
        Well, at least there are multiple ways to do a task.
        As long as I got this working - I'm good.
          Woodlands Ad Agency
          Our blog should NOT be read by anyone....EVER http://woodlandsadagency.com/blog/
          ...Don't say we didn't warn you.
          • 38290
          • 712 Posts
          You can see in opengeek's post on tags as the result of conditionals that you could optimize by slightly moving the square brackets around
          http://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/
            jpdevries
            • 40045
            • 534 Posts
            good point, you can easily replicate the same behavior like this:

            [[[[*resource:is=`Yes`:then=`$someChunk`:else=`$someOtherChunk`]]]]


            anyways, I think you should use the :else=`` thing always with :then stuff, had some problems when omitting it...
              • 24865
              • 289 Posts
              Quote from: exside at Apr 14, 2013, 05:36 PM
              good point, you can easily replicate the same behavior like this:

              [[[[*resource:is=`Yes`:then=`$someChunk`:else=`$someOtherChunk`]]]]


              anyways, I think you should use the :else=`` thing always with :then stuff, had some problems when omitting it...
              Exactly, and this has proven to be much, MUCH faster.

              Brief explanation on that: MODX parses from the inside out. When you quote `[[$stop]]` and `[[$chunkytime]]`, both chunks are parsed to determine output, wheras now your IF statement simply returns $stop or $chunkytime, which is then parsed via the normal MODX method.
                @MarkGHErnst

                Developer at Adwise Internetmarketing, the Netherlands.
                • 42901 ☆ A M B ☆
                • 73 Posts
                Responses such as these are what make this forum so great. I'm a non-programmer who is learning the basics in order to make MODX do what I want.
                Learning to separate with a simple : rather than [[ ]] was new to me.
                  Woodlands Ad Agency
                  Our blog should NOT be read by anyone....EVER http://woodlandsadagency.com/blog/
                  ...Don't say we didn't warn you.