2009/9/18 Sourav <[email protected]>:
>
> I am building a social networking site using CakePHP.
>
> The requirement is allow the user have a profile page, whose URL
> should have following format:
>
> www.mydomain.com/<username>
>
> where <username> is the unique id that the user has chosen during
> registration.
>
> My questions are:
>
> 1) Since CakePHP's routing assumes the 1st parameter after the domain
> name to be the controller name, how do I accomplish it?
>
> 2) Even if I setup a route for this purpose, in routes.php, how do I
> make sure that there isn't a conflict between the <username> and any
> controller name ?
>
> - Thanks in advance
In config/route.php
Router::connect('/home/', array('controller' => 'pages', 'action' =>
'display', 'home'));
Router::connect('/controller/*', array('controller' => 'controller'));
Router::connect('/othercontroller/*', array('controller' =>
'othercontroller', 'action'=>'something'));
// Last and default route.
Router::connect('/:slug/:action/*', array('controller' => 'usercontroller'));
In user_controller.php
function index(){
debug($this->params['slug']);
}
--
Oséias Ferreira.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---