On 05/03/11 11:06, John M. Dlugosz wrote:
> The following does not work:
> <a href="[% c.uri_for_action("/gallery/show", $name) %]">
> but through trying different things, I found that this does:
> ..., "$name")...
> why? What is the first line interpreted as? It doesn't give any error. It
> would seem to produce no second argument at all.
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
'uri_for_action' accepts a string as its first argument, then references
to arrays and hashes for its remaining arguments:
http://search.cpan.org/~bobtfish/Catalyst-Runtime-5.80032/lib/Catalyst.pm#$c-%3Euri_for_action(_$path,_\@captures?,_@args?,_\%query_values?_)
By preceding a variable name with the $ sigil in TT, you are invoking
variable interpolation:
http://template-toolkit.org/docs/manual/Variables.html#section_Variable_Interpolation
You are therefore attempting to pass the value of the 'name' variable as
the second argument, rather than the required reference.
What you probably want is:
[% c.uri_for_action("/gallery/show", [name]) %]
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates