Rod,

I did something very similar to generate entry forms for end users.
Many dynamic portions of the form really were only dynamic at the
institution level not at the end-user level so I set up a two-tiered
template system. 

Only once, at setup time, a master template is read and used to create the
template for the end user's entry form. That way the end user is hit with a
minimum of template parsing.

I accomplished this by using normal TMPL_VAR's in the master template for
items to be replaced at the institution level.
For those items that were end-user specific, I used psuedo-tags like -

        <form_VAR NAME=last_name>

These tags are ignore by H::T during it's parsing. I then just assign the
ouput to a variable -

        my $output = $template->output;

and perform a search/replace of my tags just prior to writing the output
file

        $output =~ s/form_VAR/TMPL_VAR/g;
        print $fh $output;       #  $fh is a previously opened FileHandle

That way, the output template contains static content for all
institution-level items and TMPL_VAR's
for end-user content.

Hope this helps.
Steve

Steve Ragan
Sr. Internet Developer
Internet Services Division
Bernard C. Harris Publishing Co., Inc.
2500 Westchester Ave.
Purchase, NY  10577
(914) 641-3948
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>



-----Original Message-----
From: Rod [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 23, 2002 2:40 PM
To: [EMAIL PROTECTED]
Subject: [htmltmpl] templates for templates


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'>

Then, I can process the newly created template using actual data.

FYI, I have an application that uses around 30 individual templates, but
they fall into three groups. So, I intend to create three master
templates, generate the template from them using a data definition hash
I have, then process the generated template against the data. Yes, I
know it is weird, but it will make the code so much prettier and easier
to maintain by the client, ie if a "real" template doesn't exist, a
generic one will be generated automagically.

I was planning to simply create my own template builder, but decided to
see if this would work.

Rod

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

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

Reply via email to