Probably has to do with how EE parses it’s own tags vs. PHP tags (and the input/output mix), but I had to fiddle with some nested EE tags and landed on a way that didn’t seem obvious to me so I thought I’d share.
Basically i have an embedded variable I use to determine whether to switch a weblog parameter on or off. In one particular case though, I need to also compare with the current year. So in all, I have EE tags nested 3 deep. The current_time one was causing problems (read: not working) until I wrapped it in single quotes. So here’s what I thought would work:
{exp:weblog:entries weblog="notizen" {if embed:by_jahr > 0} year="{embed:by_jahr}" {/if} {if embed:by_jahr == {current_time format="%Y"}} offset="1" {/if} orderby="date" sort="desc" dynamic="off" disable="pagination|trackbacks"}
and here’s what actually works:
{exp:weblog:entries weblog="notizen" {if embed:by_jahr > 0} year="{embed:by_jahr}" {/if} {if embed:by_jahr == '{current_time format="%Y"}'} offset="1" {/if} orderby="date" sort="desc" dynamic="off" disable="pagination|trackbacks"}
Just to save someone else a few minutes in the future.
