Please disregard. I've just figured out that the '#' param is not the
culprit. I'll post another query with a better subject line.

On Thu, Oct 14, 2010 at 9:40 PM, cricket <[email protected]> wrote:
> 1.3.4
>
> I'm working on a Comment plugin. If a user is not logged in, they'll
> see a "log in to comment" link instead of a button. I'd like it so
> that, after the user has logged in, they'll be directed back to the
> page. Easy enough, I set Session's Auth.redirect in the action.
> However, I'd also like for theuser to be redirected to where the
> comments begin on the page. I tried adding '#' => 'comments', like so:
>
> $this->Session->write(
>        'Auth.redirect',
>        array_merge(
>                Router::parse($this->params['url']['url']),
>                array('#' => 'comments')
>        )
> );
>
> (Actually, this was set in the controller, as I'm still figuring this
> out,, but would normally be done in the plugin component)
>
> So, this will be set in the session when the view is displayed. The
> trouble is, this causes the original controller's action route, which
> is already complex, to be different. eg.
>
> Router::connect(
>        '/galleries/:year/:month/:day/:slug',
>        array(
>                'controller' => 'galleries',
>                'action' => 'slug'
>        ),
>        array(
>                'year' => '2[0-9]{3}',
>                'month' => '0[1-9]|1[012]',
>                'day' => '0[1-9]|1[0-9]|2[0-9]|3[01]',
>                'slug' => '[-_a-z0-9]+',
>                'pass' => array('year', 'month', 'day', 'slug')
>        )
> );
>
> After adding the '#' param to the redirect route, the controller's
> route is no longer properly recognised. I'm still somehow directed to
> the slug action of GalleriesController, but all of the params that
> should be passed are instead in the URL itself.
>
> Now, I was under the impression that '#' should not interfere with a
> route. So, I'm wondering if the way I've merged it in is incorrect.
> Notice how the target is added to the URL:
>
> /galleries/slug/year:2010/month:07/day:13/slug:a_slug_here/pass:Array#comments
>
> This being a plugin, I don't want to have to add a '#' param to every
> route. Can anyone suggest of a better way of dealing with this?
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to