It would be nice to set a template variable from a template file itself as well as from code. Here's an example I just ran into of why:

Several CGI programs use various .tmpl files which all TMPL_INCLUDE foo.inc.
foo.inc itself includes bar.inc, although it is not the only file that does so.

However, due to something unique about foo.inc, it would be desirable to pass a parameter from it to bar.inc to change its behavior slightly.

In the case I encountered, foo.inc is in a different directory and some relative links in bar.inc therefore broke. bar.inc is a very complicated file and making an edited copy is unattractive. And symlinking is unappealing for other reasons.

So using a TMPL_VAR in bar.inc to get the links right seems the best approach; being empty by default would be the right behavior for every use of bar.inc that didn't come from foo.inc. However, I would have to set this variable in each of the CGI programs that ends up using foo.inc. Obviously, I'd rather just change foo.inc.

Now, maybe I'm missing some more obvious way of doing it, and maybe I'll find it when I think a bit more about a workaround, but what I'd like to do right now is put something like

<TMPL_VAR NAME="fred" VALUE="flintstone">

in foo.inc and have "flintstone" become the value of any <TMPL_VAR NAME="fred"> thereafter in that file or any included files. I tried DEFAULT but it doesn't work that way, and it doesn't look like it's intended to either.

I imagine this would throw a large wrench into the implementation model, but I thought I'd ask anyway.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/



-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to