|We don't bite newbies here... much|
Abstracting away layout details when using large HTML::Template-based sites?by skx (Parson)
|on Dec 08, 2007 at 12:48 UTC||Need Help??|
skx has asked for the
wisdom of the Perl Monks concerning the following question:
I've got a large CGI-based application which is in need of a graphical overhaul, only I've run into a snag working out how to do that.
Right now I've got a large collection of HTML::Template files which make up the site, with each "page" of the site coming from a distinct template. Each template contains basically the page-specific stuff and the actual layout code. The latter I'd like to abstract away to make a site redesign more feasible.
My initial plan was to split up the site such that each template would only contain the "body" of the output - and have a global template which would define the layout information. To that end I've written a simple test program:
Unfortunately this doesn't work as expected because the nested expansion of the $title in the body template fails to occur.
Does anybody have suggestions on how I could fix this? Or a better idea on how to keep a consistent and maintainable site design over a number of templates?
For reference here are the templates - as you can see I'm trying to only need to setup the $title expansion once, and have it apply to both the "layout" and the "body":