On Dec 10, 4:34 pm, boris <[EMAIL PROTECTED]> wrote:
> Hi. I am new to CakePHP and would be thankful for help:
>
> I'm creating a social networking website. Suppose I want to create a
> profile page, which displays a user's data. The view would be app/
> views/users/profile.php and there would be a controller app/
> controllers/users_controller.php with a profile() function (i.e.
> action).
>
> What if I want to create a homepage? I don't want this homepage to be
> under app/views/users and have a corresponding homepage() function is
> app/controllers/users_controller.php. I want the homepage to have
> access to data from the 'users' table (e.g. to display a random user's
> information),

A view receives it's data from a controller, a controller gets
information from models.

Where you put the controller and action for your homepage is up to you
- above you have described a controller action which requires access
to your User model, that doesn't mean the action must go in the Users
controller. Create a new one named WhateverController with a $uses =
array('User') and route / to WhateverController and whatever function
if you prefer - makes no difference to cake of course.

hth,

AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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