Published by Mijingo

movie icon image

EE Insider Blog

Spend your time learning and developing sites with ExpressionEngine and we'll use this blog to keep you informed of all the news related to ExpressionEngine and CodeIgniter.

» Read more in the Archives.

» Have a tip? Send us your EE news.

Learn ExpressionEngine Today

Over a series of 8 videos, watch and learn as Ryan builds an entire ExpressionEngine website from beginning to end. Get started now.

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. smile

Posted on Nov 25, 2011 by Ryan Irelan

Filed Under: Development Tools, Life as a Web Professional

John17: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”.

Low13: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.