[Templates] match & search virtual methods.
Sean McAfee
eefacm at gmail.com
Fri Feb 29 04:25:30 GMT 2008
On Thu, Feb 28, 2008 at 8:14 PM, Sherwood Botsford <sgbotsford at gmail.com>
wrote:
> [% FOREACH section IN
> [ 'Home', 'Trees', 'Advice', 'Our_Forests', 'Links' ]
> %]
> <td style="width: 15%;">
> [% IF $template.name.search($section) %]
> <b><i>$section</i></b>
> [% ELSE %]
> <a href="../$section/Welcome.html">$section</a></td>
> [% END %]
> Debug: section is $section template is $template.name
> [% END %]
>
> The IF clause never evaluates as true.
>
> Running this, the out put of the debug section is:
>
> Debug: section is Home template is Home/Welcome.tt2
> Debug: section is Trees template is Home/Welcome.tt2
> Debug: section is Advice template is Home/Welcome.tt2
> Debug: section is Our_Forests template is Home/Welcome.tt2
> Debug: section is Links template is Home/Welcome.tt2
>
> Some wretched piece of syntax I'm missing, no doubt.
>
I imagine you probably just need to knock off those extraneous dollar signs:
[% IF template.name.search(section) %]
--Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080228/e9fdf28d/attachment.htm
More information about the templates
mailing list