EE Insider Tips
Sponsored by Mijingo's EE 2 Screencasts
ExpressionEngine mini-howtos created by the EE Insider community.
Quote your variable when using within an if condition
This has just caught me out…
Basically if your using a variable within an if condition ensure you quote it.
{assign_variable:my_entry_id="{segment_3}"}
{assign_variable:sendit="{segment_4}"}
{if "{sendit }" == "true"} {!-- <= if {sendit} is not quoted it the logic fails --}
This is true
{if:else}
This is not
{/if}
Email
Print
Post to Twitter
Post to Delicious
Add Your Comment?
You must have an EE Insider account to post comments on Insider Tips. It's fast, easy and hassle-free.
Sign up now (or login).