On Feb 16, 2009, at 1:45 PM, Andy Wardley <[email protected]> wrote: > Hi Sean, > > The way I normally approach this is to have a PRE_PROCESS config > file which does something like this: > > [% page = { > headers = [ ] > } > %] > > Then in the main template, or a template called from it, you can > write: > > [% page.headers.push('<script .../>') %] >
I have a separate array where I push inline javascript and then place it at the end of the page. IIRC that's one of the YUI performance recomendations. > The final trick is to use a WRAPPER template to add the outer HTML > wrapper. This gets added after the main template is processed. So > the page.headers will already be set by the inner template(s) by > the time you come to generate the headers: > > <html> > <head> > [% FOREACH header IN page.headers; > header; > END > %] > </head> > <body> > [% content %] > </body> > </html> > > HTH > A > > > _______________________________________________ > 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
