Thread: Re: [htmltmpl] Encode parameters (feature request?)
Brought to you by:
samtregar
From: Mathew R. <mat...@re...> - 2005-06-23 23:45:13
|
You could sub-class H::T then overload param() to do whatever you needed = to do. Would this help? Mathew ----- Original Message -----=20 From: "Dan Horne" <dan...@re...> To: "'Mathew Robertson'" <mat...@re...> Sent: Friday, June 24, 2005 9:07 AM Subject: RE: [htmltmpl] Encode parameters (feature request?) > My understanding is that this belongs in the template tags. I'm hoping = for > an option that can help simplify things in one place... >=20 > Dan >=20 > > -----Original Message----- > > From: Mathew Robertson [mailto:mat...@re...]=20 > > Sent: Friday, 24 June 2005 11:01 > > To: dan...@re... > > Subject: Re: [htmltmpl] Encode parameters (feature request?) > >=20 > >=20 > > have you tried using the ESCAPE option to TMPL_VAR? > >=20 > > Mathew > >=20 > > ----- Original Message -----=20 > > From: "Dan Horne" <dan...@re...> > > To: <htm...@li....> > > Sent: Friday, June 24, 2005 8:39 AM > > Subject: [htmltmpl] Encode parameters (feature request?) > >=20 > >=20 > > > I guess this is a new feature request, but I'd like to be able to=20 > > > encode the parameters passed to HTML::Template automatically. So=20 > > > instead of > > >=20 > > > use HTML::Entities; > > > .. etc .. > > >=20 > > > $template->param('my_content', encode_entities($my_content)); > > >=20 > > > I'd like to be able to do: > > >=20 > > > my $template =3D HTML::Template->new(=20 > > > filename =3D> 'file.tmpl',=20 > > > encode =3D> 1 > > > ); > > >=20 > > > Regards > > >=20 > > > Dan > > >=20 > > >=20 > > >=20 > > > ------------------------------------------------------- > > > SF.Net email is sponsored by: Discover Easy Linux Migration=20 > > Strategies=20 > > > from IBM. Find simple to follow Roadmaps, straightforward = articles,=20 > > > informative Webcasts and more! Get everything you need to get up = to=20 > > > speed, fast. = http://ads.osdn.com/?ad_id=3D7477&alloc_id=3D16492&op=3Dclick > > > _______________________________________________ > > > Html-template-users mailing list=20 > > > Htm...@li... > > > https://lists.sourceforge.net/lists/listinfo/html-template-users > > >=20 > >=20 >=20 > |
From: Dave W. S. <dw...@da...> - 2005-06-26 05:24:23
|
Mathew Robertson writes: > You could sub-class H::T then overload param() to do whatever you > needed to do. > > Would this help? Sometimes params are destined for an ESCAPE=HTML tag, and sometimes they're headed for one that's ESCAPE=0, and param() isn't in a position to know which. If you override param() to use HTML::Entities::encode_entities(), you have to stick with ESCAPE=0 in your templates, lest you get double encoding of '&'. We opted to patch HTML::Template to do the escaping for us. I submitted a patch for this a while back (and a co-worker submitted a corrected patch to fix the detail I missed). The patch will be in the archives somewhere. We've been using the patch in production for nearly a year, and are happy with it. An alternative would be to run the ->output() through HTML::Entities::encode_entities() before printing (taking care to not mangle HTML). Dave |
From: Dan H. <dan...@re...> - 2005-06-23 23:46:34
|
Could do. I'll look into it... cheers Dan > -----Original Message----- > From: Mathew Robertson [mailto:mat...@re...] > Sent: Friday, 24 June 2005 11:44 > To: dan...@re... > Cc: HTML::Template users > Subject: Re: [htmltmpl] Encode parameters (feature request?) > > > You could sub-class H::T then overload param() to do whatever > you needed to do. > > Would this help? > Mathew > > ----- Original Message ----- > From: "Dan Horne" <dan...@re...> > To: "'Mathew Robertson'" <mat...@re...> > Sent: Friday, June 24, 2005 9:07 AM > Subject: RE: [htmltmpl] Encode parameters (feature request?) > > > > My understanding is that this belongs in the template tags. > I'm hoping > > for an option that can help simplify things in one place... > > > > Dan > > > > > -----Original Message----- > > > From: Mathew Robertson [mailto:mat...@re...] > > > Sent: Friday, 24 June 2005 11:01 > > > To: dan...@re... > > > Subject: Re: [htmltmpl] Encode parameters (feature request?) > > > > > > > > > have you tried using the ESCAPE option to TMPL_VAR? > > > > > > Mathew > > > > > > ----- Original Message ----- > > > From: "Dan Horne" <dan...@re...> > > > To: <htm...@li....> > > > Sent: Friday, June 24, 2005 8:39 AM > > > Subject: [htmltmpl] Encode parameters (feature request?) > > > > > > > > > > I guess this is a new feature request, but I'd like to > be able to > > > > encode the parameters passed to HTML::Template > automatically. So > > > > instead of > > > > > > > > use HTML::Entities; > > > > .. etc .. > > > > > > > > $template->param('my_content', encode_entities($my_content)); > > > > > > > > I'd like to be able to do: > > > > > > > > my $template = HTML::Template->new( > > > > filename => 'file.tmpl', > > > > encode => 1 > > > > ); > > > > > > > > Regards > > > > > > > > Dan > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > SF.Net email is sponsored by: Discover Easy Linux Migration > > > Strategies > > > > from IBM. Find simple to follow Roadmaps, straightforward > > > > articles, > > > > informative Webcasts and more! Get everything you need > to get up to > > > > speed, fast. > http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > > > > _______________________________________________ > > > > Html-template-users mailing list > > > > Htm...@li... > > > > https://lists.sourceforge.net/lists/listinfo/html-template-users > > > > > > > > > > > > |