I'm trying to set up a conditional in a .tt2 file using perl. I have an object page
that i need to check the title against. however I can't seem to get it to work. where am I going wrong here?
I'm just trying to dump out the content at this stage to make sure its working but it just throws a cannot render template
error message
[% IF page.title eq 'User Api List' %]
[%
"<pre>";
USE dumper(indent = 1);
dumper.dump(page.title) | html
"</pre>";
%]
[% END %]
When I run that code it says:
file error - parse error - test.tt line 3: unexpected token (eq) [% IF page.title eq 'User Api List' %]%
Template Toolkit is not Perl.
The comparison operator for strings is ==
not eq
You also forgot the ;
after | html
.