On Fri, Apr 15, 2011 at 1:48 PM, Sergio <[email protected]> wrote:
> Thanks for the response, although I have to say that it help only partially.
> Maybe my fault since
> I forgot to mention also that I'm using the ACL Plugin and that the URL in
> the admin reads:
>
>  [www.example.com/admin/acl/acos] at the time I attempt to logout.
>
> BTW, adding the ['router'=>'0'] takes me to:
>
>  [www.example.com/acl/users/logout] notice the 'acl'
>
> closer that the previous that was:
>
>  [www.example.com/admin/acl/users/logout]
>
> but not quite there.
>
> So, I realized that using the straight path works just fine, but not sure is
> the best approach.
>
> $this->Html->link('Logout','/users/logout');
>
> Comments pls… also couldn't find in the documentation about using the
> 'admin=0' to collapse the URL, and I would very much appreciate a pointer to
> some literature that explains it, since it seems useful.

I should have been clearer. You define the route as having admin = 0.
This should work:

Router::connect(
        '/logout'
        array(
                'admin' => 0,
                'controller' => 'users',
                'action' => 'logout',
        )
);

echo $this->Html->link(
        'Log Out',
        array(
                'admin' => 0,
                'controller' => 'users',
                'action' => 'logout',
        )
);

So, if you're on an admin page (admin == 1), this will force the admin
option for the link to be 0. Otherwise, Cake will use the current
setting, just as it will with controller, ie. link('foo',
array('action' => 'foo)).

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to