> I'm looking for suggestions on how to get a value from my template that can
> be used in my Perl code. I'd rather not switch to another template module
> that would provide this since HTML::Template has otherwise met my needs.
>
> The details...
>
> In my template, I'd like to have something like:
>
> <TMPL_VAR NAME="QUERY" VALUE="SELECT col1, col2 FROM table">
>
> and then do something like this in my Perl code:
>
> my $template = HTML::Template->new(filename => 'test.tmpl');
> my $value = $template->param('QUERY');
>
> and have $value = "SELECT col1, col2 FROM table"
umm... why? What benefit does this give you? What kind of output are you expecting
from the TMPL_VAR?
... its not clear how this requirement would be all that useful... or would even make
sense in the context of "seperation of code and presentation" that H::T provides...
> My three thoughts are:
>
> 1. use a filter, but I don't know how to get $template instead of the filter
> subroutine so I can call $template->param to set the value. The only thing
> passed to the filter subroutine is the text of the file and not $self?
>
> 2. extend HTML::Template to handle this via the existing TMPL_VAR or add a
> new tag TMPL_DEFINE
>
> 3. Use HTML::Template::Expr, but my experience is that ::Expr is slow and I
> don't need all the other features it would provide.
Using H::T::E sounds like the best solution...
Mathew
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id065&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users