Hi
I have this code
{assign_variable:entry_test="Yes"}
{if entry_test != "Yes" }
<h1>404</h1>
{/if}I still see the <h1>404</h1> is showing, why?!~?
can anyone help?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
March 23, 2009 9:06am
Subscribe [2]#1 / Mar 23, 2009 9:06am
Hi
I have this code
{assign_variable:entry_test="Yes"}
{if entry_test != "Yes" }
<h1>404</h1>
{/if}I still see the <h1>404</h1> is showing, why?!~?
can anyone help?
#2 / Mar 23, 2009 4:07pm
It’s a question of parse order, ie when and how various parts of your template are parsed by EE. As a rule, EE variables are simple string replacements, performed once at the beginning of code execution which cannot be changed at runtime.
That said, give this a try:
{assign_variable:entry_test="No"}
{if "{entry_test}" != "Yes" }404{/if}As a rule, quoting your variables is not supported and depending on the source of the variable, may even have security implications. By doing this, you are allowing the tag that “owns” that variable to parse and replace it with its unfiltered contents. Doing so is trusting that it has no bad characters, no javascript, and no need for error checking that is normally performed when the conditional is used with the proper syntax outline above. Since you are assigning the value yourself in the template, you should be OK. Makes sense?