I have a list of 4 things options. Up to 2 can be selected and will output different icons. Using the P&T Multiselect, I followed the docs to say:
{if {my-field:selected option="red"}}Red{/if}
{if {my-field:selected option="yellow"}}Yellow{/if}
..and so on.
However, the template throws the error: Parse error: syntax error, unexpected ')' in /.../www/www/adm/expressionengine/libraries/Functions.php(656) : eval()'d code on line 282
Any ideas on why?
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
Update: I'm using a single template to drive three separate pages using if-statements. e.g. landing page, listing page, and detail page. This is meant for the detail page. The above is ONLY causing the error on the landing page, the first overall if-statement.
-
-
Hi Chris,
Reason for this is that EE will simply remove tags for fields that don’t have any data, so by the time that your conditional is parsed, it looks like:
{if }
which is causing the parse error.
To prevent the error, simply wrap your P&T Multiselect tags in quotes:
{if "{my-field:selected option="red"}"}Red{/if}
{if "{my-field:selected option="yellow"}"}Yellow{/if}
That way, if the tag is removed, there’s still something in there – an empty string:
{if ""} -
-
-
-
Just upgraded to EE2, converted all FF fields to P&T fields and and ran into this same problem.
You're solution worked perfectly, thanks! -
Loading Profile...



EMPLOYEE

