Hello everyone,

I have a simple question :

In my app, I use router + controller to get url like this :

/profile/HASH ( myapp.com/profile/hgv5435634vfhcfg6YVC4 )


Routes :

Router::connect('/profile/:hash', array('controller' => 'users', 'action' 
> => 'view'), array('pass' => array('hash')));


Controller :

public function view($id) {
>     $user = $this->User->find('first', array(
>     'conditions' => array('User.hash' => $id),
>     ));
>     $this->set(compact('user'));
>     }


In my users database, I have hash and username fields.

The hash is used to get data from another website from a user's email.

But I want users to be able to get their profile from 

 /profile/username ( myapp.com/profile/username )

too.

How is this achievable ?

Thanks a lot for your time.

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