Hi,

There are two way to handle this. 

Add these lines above your other users routing rules. If you put it below your 
other rules, then the router will think "login" is a username. This is not an 
advisable approach since you can no longer have users with the names "login" or 
"logout", and every time you need to add a new action to the UsersController 
you'll have to add another rules.

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

You can get around this with the second approach by not using the prefix of 
users for non-user related actions.

Router::connect('/members/:action',array('controller'=>'users'));

Now your logins can be handled by http://example.com/members/logout and 
http://example.com/members/login

You can also just keep it real simple http://example.com/login would be

Router::connect('/login',array('controller'=>'users','action'=>'login'));


----- Original Message ----
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
To: CakePHP <[email protected]>
Sent: Friday, October 3, 2008 5:16:31 PM
Subject: Re: URL routing


Great, that helped a lot.  A follow up issue I am having is what is
the correct way to handle such things as login / logout functions in
the user controller so that when I go to http://example.com/users/logout,
it doesn't query the database and it performs the logout functions.

Thanks again for your help before

On Oct 3, 9:41 am, Mathew <[EMAIL PROTECTED]> wrote:
> Router::connect('/users/:username',
> array('controller'=>'users','action'=>'index'),array('pass'=>array('username')));
>
> This routes /users/bobcostas to the function index( $username ) method
> of the controller, with the username passed as a parameter.
>
> Router::connect('/users/:username/:action',
> array('controller'=>'users'),array('pass'=>array('username')));
>
> This does the same as the above, but allows the action to be after the
> username. For example; /users/bobcostas/edit would call function
> edit( $username ) in the UsersController.


      
--~--~---------~--~----~------------~-------~--~----~
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