[Catalyst] Please help to figure out with URL's

Mark Ellis m at rkellis.com
Thu Dec 4 21:07:10 GMT 2014


On 4 December 2014 at 20:31, Larry Leszczynski <larryl at emailplus.org> wrote:

>
> On Thu, Dec 4, 2014, at 12:41 PM, Trevor Leffler wrote:
> > This is a typical use:
> >
> > <link href="[% c.uri_for('/static/css/my_style.css') | html %]"
> rel="stylesheet">
>
> Assuming you're using Template Toolkit, you should use the "url" filter,
> not the "html" filter:
>
>    <link href="[% c.uri_for('/static/css/my_style.css') | url %]"
>    rel="stylesheet">
>

afaik a url should be uri encoded when it's a url, and everything should be
html encoded when in html. the point being uri_for already uri_encodes the
url, and you should then html encode it when embedding it on the page, as
'&' is valid in a url, but not vaild in html

so <link href="[% c.uri_for('/static/css/my_style.css') | html %]"
rel="stylesheet"> would be the correct method


> Larry
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20141204/663397fd/attachment.htm>


More information about the Catalyst mailing list