Re: why this substitution is not working?
Rajeev Prasad <rp.neuli-/[email protected]> Fri, 15 Aug 2014 18:27:49 -0700
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
figured. it was just needing the absolute path to the file. On Friday, August 15, 2014 6:13 PM, Rajeev Prasad <rp.neuli-/[email protected]> wrote: thx that works. but why is this not working now? it seems it is not working inside the File() [% TRY %] [% USE File("myfile.$userid") %] [% INCLUDE "myfile.$userid" %] [% CATCH File %] [% INCLUDE "myfile.general" %] [% END %] On Friday, August 15, 2014 1:39 PM, Dave Cross <[email protected]> wrote: On 15/08/14 19:22, Rajeev Prasad wrote: > > calling script code snippet: > > $vars = { > userl => $userid > }; > > my $tt = Template->new(); > $tt->process($vars)|| die $tt->error(); > > the template.... > [% IF userl == 'ABC' %] > [% INCLUDE myfile.ABC %] > [% ELSIF userl == 'DEF' %] > [% INCLUDE myfile.DEF %] > [% END %] > > it is working, but it is a long list so i want to change it to: > > [% INCLUDE myfile.[% userl %] %] > > THIS is not working. can someone tell me why, pl? It's not working because you can't embed directives within directives. You want this: [% INCLUDE "myfile.$userl" %] Cheers, Dave... _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates _______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates