Published by Mijingo

tips icon image

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

User's avatar
  • Posted by johnniefp
  • March 09, 2010
  • 1 person has found this tip helpful.

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} 

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

Search EE Insider Tips
Sponsored By