Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Dynamic includes in Template::Toolkit

by zby (Vicar)
on May 07, 2003 at 11:34 UTC ( [id://256165]=note: print w/replies, xml ) Need Help??


in reply to Dynamic includes in Template::Toolkit

Perhaps I've misunderstood something - but it seems fairly simple - just use a variable ($header). From TT manual (Directives):
[cut] The INCLUDE directive automatically quotes the filename specified, as +per INSERT described above. When a variable contains the name of the +template for the INCLUDE directive, it should be explicitly prefixed +by '$' or double-quoted [% myheader = 'my/misc/header' %] [% INCLUDE myheader %] # 'myheader' [% INCLUDE $myheader %] # 'my/misc/header' [% INCLUDE "$myheader" %] # 'my/misc/header'

Replies are listed 'Best First'.
Re: Re: Dynamic includes in Template::Toolkit
by Molt (Chaplain) on May 07, 2003 at 11:46 UTC

    No, this is exactly what I was trying to do. It's been a while since I used tt2 so just went to the normal POD rather than the manual.

    Thank you very much for this, saves me an awful lot of switch statements.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://256165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-03-29 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found