I have a problem with conditionals not working with a snippet value.
First, a session is set with one of two values; “HWN” or “ENG” using the “session_variables” plug-in.
Second, a snippet is defined using the get method from the “session_variables” plug-in, like so:
“Snippet Name”: k_lang
“Variable Content”: {exp:session_variables:get name='k_lang'}
Third, when I view the page containing the following conditional, it doesn’t seem to work. Here is the conditional statement from the template:
{if {k_lang} ==‘HWN’ }
<<display this>>
{if:else}
<<display that>>
{/if}
If I hit the template with the above EE tags, it always evaluates to <<display that>>. If I replace the snippet value with a static string of “HWN”, then it evaluates to <<display this>>, which is the correct outcome.
I have tested if the snippet value is being parsed by EE by just echo’ing out {k_lang} in the template…which it does. I also ran the value through a plug-in that uses PHP’s trim function to strip any invisible characters.
Any ideas why the conditional doesn’t behave in an expected way? Thanks!