Friday, July 16, 2010

Re: Nickname routing question

On Thu, Jul 15, 2010 at 3:42 PM, Hugo Massaroli <hugom@delapalo.com> wrote:
> Hi CakePHP community! I have a doubt about routing and accesing models while
> routing. The thing is I have two models:
>
> user, and group.
>
> Both have show pages.
>
> I want to have nicknames so I have a nicknames table and I want to access
> the show method in this way:
>
> www.mydomain.com/thisismygroup1
> www.mydomain.com/user34
>
> Nicknames table:
> id
> group_id
> user_id
> detail (nickname)


Nicknames table:
id
model
foreign_key
name

Fetch the row based on the requested name and redirect to the correct
controller, passing the foreign_key value as ID. Or, better, associate
this model with both User and Group so that your NicknamesController
can get it straight from whichever model, eg.
$this->Nicknames->Group->find(...). Then you'd jusy need to do:

$this->viewPath = 'groups';
$this->render('view') ;

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate