On Wed, Dec 10, 2003 at 12:18:52PM +1100, Mathew Robertson wrote: >Is this implemented as a filter? In any case, I would be interested in having a look >at how you did this.
Very much like the param version just posted here. Insert tags of the form: <tmpl_set name=x value=y> with _no_ quoting around the x and y (this is a quick-and-dirty hack); each one will provide a value for a top-level parameter. You can't do anything about values within loops with this. package HTML::Template::Set; use HTML::Template; use base qw(HTML::Template); sub new { my %set_params; my $set_filter = sub { my $text_ref=shift; my $match='<(?:\!--\s*)?tmpl_set\s*name=(.*?)\s*value=(.*?)\s*(?:--)?>'; my @taglist=$$text_ref =~ m/$match/gi; while (@taglist) { my ($t,$v)=(shift @taglist,shift @taglist); $set_params{$t}=$v; } $$text_ref =~ s/$match/<tmpl_if name=never><tmpl_var name=$1><\/tmpl_if>/gi; }; my $proto = shift; my $class = ref($proto) || $proto; my $self=HTML::Template->new(filter => $set_filter, @_); bless ($self, $class); $self->param(%set_params); return $self; } 1; ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users