Re: Possibility to include files "dynamicly"

Michael Peters <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>

Maaged Mazyek wrote:
> Hello ppl,
> 
> in one of my templates i have a loop. On every pass, i want to include a
> different file.
> in short, i want to to something like this, but of course it does not
> work this way:
> 
> <TMPL_LOOP testloop>
> <TMPL_INCLUDE NAME="/path/to/foobar/<TMPL_VAR NAME="DOC_ID">.html">
> </TMPL_LOOP>
> 
> DOC_ID is every time different. My current solution is to do it with a
> php-include, but that just shifts the usage of the cpu to php.

You can't do it in the template, so you do need to shift the burden to someplace
else. But you can just do it in your Perl code that passes the variables to the
template.

In the code where you generate the data for the loop, create another template
object, pass in the same variables, get it's output and then use that output as
a var in your parent template.

-- 
Michael Peters
Developer
Plus Three, LP


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.