Re: [Templates] Templates in database
[prev]
[thread]
[next]
[Date index for 2004/08/30]
On Mon, 30 Aug 2004, Dennis Daupert wrote:
> I'm trying to learn how to store my templates in a database
> and use from there. I must be missing something simple, but
> can't seem to get the variables to resolve.
>
> I have a template like:
>
> Dear [% emp_fname %]:
>
> Your application requesting an ID has been approved.
>
> If you have any questions, please contact the ID Administrator
> at [% IDAdminEmail %].
>
> Then I read it out of the database:
>
> [% query = DBI.prepare('SELECT * FROM email WHERE emailid = ?') %]
>
> [% FOREACH tmpl = query.execute('1') %]
> [% email = tmpl.body %]
> [% END %]
>
> Then I display -- just to see what he's done:
>
> <pre>[% email %]</pre>
>
> He shows me the original template, but none of the template tags
> (variables)
> are resolved.
>
> What am I doing wrong here?
Dennis,
I think you want:
<pre>[% email | eval %]</pre>
But as Randal pointed out last week, you can't take advantage of
extremely advantageous template caching mechanism built into TT2
(via the COMPILE_DIR, COMPILE_EXT and CACHE_SIZE config options).
Dave
/L\_/E\_/A\_/R\_/N\_/T\_/E\_/A\_/C\_/H\_/L\_/E\_/A\_/R\_/N\
Dave Cash Power to the People!
Frolicking in Fields of Garlic Right On-Line!
dave@xxxxx.xxx Dig it all.
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates
 |
 |
Re: [Templates] Templates in database
Dave Cash 22:11 on 30 Aug 2004
|