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.