On Tue, Apr 23, 2002 at 01:40:12PM -0500, Rod wrote:
> This may sound strange, but I need to create a template to generate a
> template in my application. In other words, I will have an entry like
> 
> <TMPL_VAR NAME='<TMPL_VAR NAME='column'>>
> 
> and want it to be changed to 
> 
> <TMPL_VAR NAME='mycolumn'>

It does not sound strange at all. I find myself generating templates,
scripts, modules and whatnot all the time.  In fact, I was discussing this
very problem with a cow-orker recently and suggested that he decide on
'levels' of template generation, where the first pass could be level 1, the
second, 2, etc.  Then you could prefix each tmpl_* directive with its level,
then at template generation time, just transform (with a filter) the directives that 
belong
to this level (or higher) into standard tmpl_* directives so html::Template will
understand them. An example:

Start off with a template like this:

<2_TMPL_VAR NAME='<1_TMPL_VAR NAME='column'>>

so your first level filter will change that to

 <2_TMPL_VAR NAME='<TMPL_VAR NAME='column'>>

Which gets transformed into 
 <2_TMPL_VAR NAME='mycolumn'>

which will later be transformed into
 <TMPL_VAR NAME='mycolumn'>


Obviously, you're hardcoding the 'meta-level' into your various processing
scripts.  In general, I use a different template system to generate the
first level. HTML::Template is great, but not for everything.

gslgen
autogen
metahtml

are all good systems (depending on what you're doing).

-Gyepi



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to