My USERS in my application all have a unique slug. example profile/johndoe
 
Now when John wants to edit his profile all of his data is found by his ID
and not his SLUG. How can I get the ID of John based on his SLUG? Basically
use the slug for the URL then in the controller get the USER SLUG and
convert it into the USER ID.
 
for example in the controller to edits Johns favourite Artists:
 
function update_artists($slug = null)
    {
        if ($this->RequestHandler->isAjax()) {
            $this->set('user',
$this->Artist->User->findBySlug($slug));//there is no slug in the artists
table, just ID
            if (!empty($this->data)) {
                if ($this->User->save($this->data)) {
                }
            }
            $artists= $this->Artist->User->find('list', array('fields' =>
artist, 'order' => artist ASC'));
            $this->set(compact('artists'));
        }
        if (empty($this->data)) {
            $this->data = $this->Artist->findBySlug($slug);
        }
    }
 
Thanks,
 
Dave 

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