Woops, that was wrong.

if (!is_numeric($id)){
        $this->User->recursive = -1;
        $id = $this->User->field('id', array('username' => $id));
}

On Jul 19, 6:23 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> You can add a quick thing like this:
>
> function view($id){
>
>         if (!is_numeric($id)){
>                 $id = $this->User->findByUsername($id);
>         }
>
>         // then your normal code from here on in
>
> }
>
> On Jul 19, 5:10 pm, Mr K <[EMAIL PROTECTED]> wrote:
>
> > Hi all
>
> > I've got a system set up where can go:
>
> >http://www.mydomain.com/users/ID
>
> > I want to change this to
>
> >http://www.mydomain.com/users/USERNAME
>
> > my users controller of course has index & view functions .... both of
> > which use ID of their search
> > Is there a quick way to change this? I still need to look up by ID for
> > other reasons, but would like both?
>
> > Thanks all
--~--~---------~--~----~------------~-------~--~----~
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