Re: [htmltmpl] TMPL_SET -- this would be nice to have.
Brought to you by:
samtregar
From: Aleksandar P. <web...@te...> - 2006-05-18 09:38:04
|
> Dear List, > > In most of my templates, I have a header and a footer templates that ge= t > included from the main template, which I assume is a very common > scenario. My problem is that <title> tag is in the header template and > it needs to change for each template. There are two approaches that I > can currently use: > > 1. Put <title> tag into main template. This works, but I do not believ= e > having <title> outside of <head> is correct HTML[1]. > > 2. Set title from CGI script. This is not very convenient and, in my > mind, breaks the paradigm. > > The best solution, in my mind, would be something like this: > > ---- template search_results.tmpl ---- > <TMPL_SET NAME=3D'TITLE' VALUE=3D'Search Results'> > <!-- this is where title is used --> > <TMPL_INCLUDE NAME=3D"_header.tmpl"> > <some_html_here> > <TMPL_INCLUDE NAME=3D"_footer.tmpl"> > ---- end of template ---- > > Questions: > > 1. Is this feasible to implement? > 2. Is such feature compatible with HTML::Template philosophy? > 3. (Bonus question) is there another approach besides the two above tha= t > I can use right now? > > Thank you, > > - Dmitri. 1) Already answered - yes. 2) Not sure ... 3) Here it is: <html> <head> <title> Whatever </title> </head> <body> <TMPL_INCLUDE NAME=3D"_header.tmpl"> .... <TMPL_INCLUDE NAME=3D"_footer.tmpl"> Anyway, I walked the similar path when I needed some things added to the = =20 HTML-Template and many sugested TemplateToolkit ... --=20 Aleksandar Petrovi=C4=87 Webmaster of Techcode.NET Web: http://www.techcode.net Skype: techcode.net Yahoo: johndoeyu ICQ: 75863829 MSN: joh...@ya... |