This is why I love Template Toolkit

So I recently learnt about Template Toolkits META directive - I mean I've seen it scattered around here and there but never really seen it do much more than provide default page titles.

I have been annoyed at the inelegant workarounds I've had to use when organising a web app with a site wrapper template and keeping all the view control in the right templates rather than in either the controller or as special cases in the wrapper.

Today I finally sorted that.. yesterday I used the meta tag to add javascript and css links to the header part of the page from a template deep inside the body of the html and today I replaced a special case flag with a sub-template specified by the meta tag, which then contains the wrapped content - rather elegant.. AND it allowed me to solve the layout issues I had after I moved the app from bootstrap 1 to bootstrap 2


... and today I learnt I didn't need the META tag and it would JustWork(TM) without it, and I'd only need it in pre-processed headers - I'll leave it as it is in case I want to switch to pre-processing later.. and I learnt that it's not that novel several of those on #TT channel of have been doing it like this for ages :(


So it sounds like this META stuff is pretty much just setting globals, but globals in the magic template variable? Or is it more than that?

Woo - who knew! - really should read more of the documentation.

That's really useful - thanks

Leave a comment

About hashbangperl

user-pic Geek, Dad, Husband, hacking perl in Cornwall see also my github and linkedin pages