Hi,
I’m wondering why this doesn’t work:
{if custom_field == "John's House"}do something{/if}Any suggestions on how to make this work?
Thanks!
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
April 16, 2012 12:10pm
Subscribe [2]#1 / Apr 16, 2012 12:10pm
Hi,
I’m wondering why this doesn’t work:
{if custom_field == "John's House"}do something{/if}Any suggestions on how to make this work?
Thanks!
#2 / Apr 16, 2012 12:23pm
Hi Zac,
Try the following:
{if "{custom_field}" == "John's House"}do something{/if}Mike
#3 / Apr 17, 2012 8:56am
Nope, that didn’t work.
#4 / Apr 17, 2012 11:23am
Hi Zac,
I am sorry to hear you are running into this problem.
When you say it does not work, what are you seeing? Does the logic fail or do you see errors?
This form should work:
{if username == "joe"} <h1>Hi Joe!</h1> {/if}Please let me know!
Cheers,
#5 / Apr 17, 2012 3:01pm
Hi,
Yes, the logic fails. If I code this:
{if custom_field == "Joe's"} Something{/if}The the conditional statement fails.
Of course, this works fine:
{if username == "joe"} <h1>Hi Joe!</h1> {/if}But it isn’t using an apostrophe.
#6 / Apr 17, 2012 3:06pm
Hi Zac,
What version of EE are you using?
Mike
#7 / Apr 17, 2012 3:10pm
They’re running 2.3.1
#8 / Apr 19, 2012 12:49pm
Hi Zac,
I tried this in 2.4 and I get the same results.
Inside a channels entry loop ...
{if title == "shane's"} 1 {/if}
{if {title} == “shane’s”} 2 {/if}
{if "{title}” == “shane’s”} 3 {/if}
{if '{title}’ == “shane’s”} 4 {/if}
The first fails, the others give me parse errors. (expected the parse errors)
This sir, is a bug. And now it’s an officially filed bug.
To stay up to date on the progress of the bug, please leave a comment.
Thanks for catching and reporting this Zac.
If you need anything else, please just let us know by opening a new thread.
Cheers,