Template Toolkit How to query a % variable % in an IF loop within a template

Letterpart
Letterpart used Ask the Experts™
on
Hi,

we are using Perl Template Toolkit and have a value of [% action %].

I want to now test this in an IF/ELSIF loop within a template but am struggling as I am simple.

My loop would look like:

[% IF action == i %]
The ACTION is I
[% ELSIF $myaction == u %]
The ACTION is I
[% END %]

But I can't work out how to test [% action %] within the IF loop.

thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Did you try adding quotes around the value?

[% IF action == 'i' %]
The ACTION is I
[% ELSIF $myaction == 'u' %]
The ACTION is I
[% END %]

Open in new window

Author

Commented:
No I hadn't and now I look at the rest of the code I realise what a div I am.

Thank you. Points are winging their way to you...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial