From: "Mike Raynham" <[email protected]>

> 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]) %]


In this case probably the arguments are needed and not the captures.

  $c->uri_for_action( $path, \@captures?, @args?, \%query_values? )

The captures might be needed when the Chained dispatcher type is used and they 
are sent as an array ref.

The arguments are sent as a simple array.

The following is enough:

<a href="[% c.uri_for_action("/gallery/show", name) %]">

Octavian


_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to