elseif or switch statements hack with phx
on 22-Sep-2011 | Comments ( 5 ) Tags: Evolution, PHx
To emulate the elseif functionality we have to use the PHx or statement and a few PHx if statements.
Hopefully the code says it all:
[+phx:if=`[*id*]`:is=`1`:or:is=`2`:then=`
[+phx:if=`[*id*]`:eq=`1`:then=`
{{Chunk-1}}
`:else=``+]
[+phx:if=`[*id*]`:eq=`2`:then=`
{{Chunk-2}}
`:else=``+]
`:else=`
{{OtherChunk}}
`+]
The above code can also be used for switch statements like functionality.
If you use this to check some value, that if changed the cache is not cleared, the page should not be cacheable. I mostly use this to check resource IDs or template IDs so the page can always be cached.

Write a comment
Posts: 3
Reply #5 on : Fri September 30, 2011, 02:59:05
Posts: 3
Reply #4 on : Sun October 16, 2011, 09:32:55
Posts: 2
Reply #3 on : Sun October 16, 2011, 09:38:29
Posts: 3
Reply #2 on : Fri October 28, 2011, 08:24:05
Posts: 2
Reply #1 on : Fri October 28, 2011, 20:20:01