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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.