[Catalyst] Views and escaping HTML

J. Shirley jshirley at gmail.com
Thu Apr 1 17:35:06 GMT 2010


On Thu, Apr 1, 2010 at 10:27 AM, Mesdaq, Ali <amesdaq at websense.com> wrote:
> You prefer global escaping to escaping in the template? I use the TT plugin for escaping
>
> [% USE HTML %]
> [% HTML.escape(needs.escaping) %]
>
> An idea that might work for you would be if you structure your data in the stash and create your templates generically looking for data in specific stash locations you could accomplish what you want with very little work (potentially) something like:
>
> [% USE HTML %]
> <title>[% data.title %]</title>
> <h1>[% HTML.escape(data.escape.something) %]</h1>
>
> Not sure if that would work for you
>

Why would you use the HTML plugin rather than just the built-in | html
and | uri filters?

The HTML plugin gives you HTML generation, using it for filtering
seems redundant.

PS., adding a template_class would be great... I'd love to have global
escaping in a few apps.

-J



More information about the Catalyst mailing list