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

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.
LVL 1
LetterpartAsked:
Who is Participating?
 
FishMongerCommented:
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

1
 
LetterpartAuthor 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...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.