From: "Rajesh_K" <[EMAIL PROTECTED]>
>Is this part of the HTML::Template::expr package?  I don't see any %...%
construct in HTML::Template. Sorry I am asking you this... ppm is down
at activestate and I cant get at the expr module!

Rajesh,

Philip is suggesting that you markup your template so that you can perform
substitution upon a token inside the template using the "filter" parameter
to the "new" method.  You can mark it up any way you want. He's suggesting
you use % characters to make it unique.

Then you do something like this:

=========
my $filter = sub {
 my $text_ref = shift;

  $$text_ref =~
  s#MY_INCLUDE#$include_filename#g;

} # end filter

$template = $HTML::Template->new($page . '.html',
    filter => [
       { sub => $filter,
         format => 'scalar' },
       ]);
==========

Or, as I said, you can use the "path" parameter to the "new" method and pass
it multiple paths (some or all of which are defined at the time the "new"
method is called.). If you can organize your includes into directories
matching the criteria by which you'd like to load them with TMPL_VAR, you
could effectively accomplish the same thing by specifying variables on the
path parameter.

I had a *really* hard time with this concept because I believed H::T was
pulling in the includes at the time it is output. I too thought I should be
able to use TMPL_VAR to change include names. But, it's pulling them in at
the time you call "new." So, your choice is to organize them into
directories and use multiple paths for H::T to search. Or, use the filter to
change values to what you want them to be (before it evaluates the TMPL_
tags).

Mark



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to