[Catalyst] uri_for and Chained actions
peter at peknet.com
Fri Oct 12 18:22:20 GMT 2007
On 10/12/2007 11:31 AM, Oleg Pronin wrote:
> I have a hundred of <img src="...."> and a hundred of <a href=".."> per
> page on 1-2mln hosts/day project.
> If your project is not under subfolder of some domain then there is no
> need to call
> <img src="[%c.uri_for('/images/img.jpg')%]"/>
> instead of <img src="/images/img.jpg"/>
> as they are both pointing to the same place.
I think best practice (for portability) is still something like:
[% img_url = c.uri_for('/images') %]
[% FOREACH img IN lots_of_images %]
<img src="[% img_url %]/foo.jpg" />
[% END %]
because you never know what the future holds, w.r.t. deploying in different
scenarios. Plus, that makes it easier to serve static content from a different
URL altogether (as I do) by just changing
[% img_url = 'http://static.mystuff.foo' %]
in one place.
Peter Karman . peter at peknet.com . http://peknet.com/
More information about the Catalyst