[Catalyst] How to get uri_for something with a fragment?
John M. Dlugosz
wxju46gefd at snkmail.com
Sun Mar 6 11:46:50 GMT 2011
On 3/6/2011 5:28 AM, Andrew Rodland andrew-at-cleverdomain.org |Catalyst/Allow to home|
wrote:
>
> Or, since you know that what it generates *doesn't* have a fragment you could
> always just $c->uri_for_action(...) . '#id' which will be perfectly valid
> (although no longer a URI object).
>
I considered that a hack until I knew better, since it won't work if there are query
arguments.
This worked:
[% IF c.action != 'index' ;
SET toplink = c.uri_for_action('/index') ;
CALL toplink.fragment('galleries') %]
<li><a href="[%toplink%]">Gallery Index</a></li>
[% END %]
though I'd certainly be interested in hearing how I could do it better.
--John
More information about the Catalyst
mailing list