EllisLab text mark
Advanced Search
     
WHY are simple and advanced conditionals parsed at different times?
Posted: 22 January 2010 01:16 PM   [ Ignore ]
Avatar
Joined: 2009-03-24
131 posts

One thing I’ve learned from my first year of EE development is that because of the parse order of advanced conditionals they usually cause more problems than they solve.  This is unfortunate, because advanced conditionals can make for much cleaner template code, and sometimes simple conditionals just won’t do.

EE is the first program/framework/language I’ve used that treats advanced conditionals differently than simple conditionals.  I’m assuming there was a good reason for this design decision - does anyone have insight as to what that reason is?

Thanks,
Aaron

 
Posted: 22 January 2010 02:50 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-14
20504 posts

ExpressionEngine isn’t a programming language, I think that’s where a lot of programmers get a bit confused with ExpressionEngine.

The advanced conditionals often need to act on already parsed tags, so they have to be parsed after the fact.  That’s how the parse order works.

You could certainly put in a feature request to change this.

 
Posted: 22 January 2010 03:49 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-03-24
131 posts

I understand that EE isn’t a programming language - my point was I’ve never run into any other system that treats simple/advanced conditionals differently.  The other issue I’ve found with advanced conditionals is that the code within the conditional always(?) runs, even when the conditional evaluates to false.  It doesn’t output anything, but it can cause performance issues, along with occasional debugging headaches.

As I said, I find I can use simple conditionals for almost everything and early parsing has never been an issue - I don’t see any advantage to late parsing for the advanced conditionals.  When post after post on the forums say “don’t use advanced conditionals!” then either something needs to be changed or there should be better documentation on the pitfalls (and benefits?) of using advanced conditionals.

-Aaron

 
Posted: 11 April 2010 08:21 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2009-09-15
52 posts

Maybe there should be an parameter of some sort that makes it parse at the same time as simple conditionals? This would be really helpful.

I am new to EE and have recently done my first two sites, and I ran into trouble when using advanced ones.

 Signature 

A lover of good thinking, great music and EE.