A Conditional Conundrum
King of the Parse Order, Low Schutte, digs up an interesting example where an EE conditional isn’t treated as you might expect. Low skirts around the issue with a preload replace variable. Sneaky, sneaky.
I won’t spoil it here, so first check out the code that Low posted as a gist and then read his explanation below it. But, try to figure it out on your own first before looking at the answer.
John — 17:26 on 11.25.2011
Yeah - but the {exp:class:method} tags be equate BEFORE the conditionals are even looked at.
That is the reality of parse order. Those tags are equated first. So unless the example tags are just outputting some simple text - I wouldn’t go counting on the example working out as expected - even with the “sneaky”.
Low — 13:47 on 11.28.2011
The point of the gist example was the simple conditional turning advanced by the presence of the if:else string inside it. I’ve updated the gist to demonstrate this in a better way than before, by moving the advanced condition inside the exp:tag for simple display purposes.