> I have actually made a whole bunch of javascript templates, and pick and
> choose which ones get included.
Same here, but I do it listwise:
[%
# (assuming some "page" hash already exists):
page.pagetitle="foo";
page.extra_scripts = page.extra_scripts || [ ] ;
page.extra_scripts.push("some-jsfile.js");
page.extra_scripts.push("another-jsfile.js");
PROCESS "generic_top.tt";
%]
my generic_top has the usual HTML "head" stuff, plus a FOREACH that loops
through page.extra_scripts
and outputs the appropriate "script" tag for each; likewise for extra CSS
files, in a
page.extra_styles list.
Back to the original question... I'd just make the determination at the
beginning of processing
(either in the main program, or top of the template) that the extra stuff was
needed, set a flag
("page.WANT_GOOGLEMAP" or something like that) then check that flag in both
places; using a flag
that has no other meaning will ensure that the results of evaluating the test
condition won't change
between the head include and the body include.
--
[email protected]
http://www.graveyards.com
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates