On Tue, 9 Dec 2003, Lance A. Brown wrote:# we allow tags like this in our templates that will define values # to be set as parameters # <TMPL_VALUE NAME="name" VALUE="value">
My eyes! It burns! Arrrrrrrgh...
:) I know it goes against your philosophy of HTML::Template, and that this can be abused in nasty ways. But there is one situation where I feel this feature is justified to keep design elements in the templates and code in the code and it has to do with needing dynamic values in include files.
The most obvious example is the <title> tag in a header. I usually include a header and footer include at the top and bottom of my templates. The most anoying thing is to fill in that <title> tag in the header include file. In the past I have resorted to putting this information in the code, but it doesn't belong there. The programmer shouldn't care what the title of the page is, that is the domain of the designer... The TMPL_VALUE filter is one way of solving this issue:
=========== content.tmpl =========== <TMPL_VALUE NAME="title" VALUE="Title of the page"> <TMPL_INCLUDE NAME="header.tmpl">
Content
<TMPL_INCLUDE NAME="footer.tmpl"> =========== content.tmpl ===========
=========== header.tmpl =========== <html> <head> <title>Application Name: <TMPL_VAR NAME="title"></title> </head> <body> <h2><TMPL_VAR NAME="title"></h2> =========== header.tmpl ===========
There are other ways around this issue by putting part of the header in each of the content templates, but I have never liked that approach:
=========== content.tmpl =========== <html> <head> <title>Application Name: Page title</title> <TMPL_INCLUDE NAME="head.tmpl"> </head> <TMPL_INCLUDE NAME="bodyheader.tmpl"> <h2>Page title</h2>
Content
<TMPL_INCLUDE NAME="bodyfooter.tmpl"> </html> =========== content.tmpl ===========
I'll admit that I haven't used this TMPL_VALUE trick in any of my code, but I can see its value -- no pun intended :)
Cheers,
Cees
------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users