The simple answer is that it goes with whatever controller you want it
to!

In the default setup, the home route '/' redirects to the
PagesController with the action 'display' and the parameter 'home',
which just displays the contents of the /app/views/pages/home.ctp
file.

If you need minimal logic in different pages, there is an article on
the bakery (http://bakery.cakephp.org/articles/view/taking-advantage-
of-the-pages-controller) which allows you to add logic to individual
pages.

If the home page is unique and retrieves lots of data, you might as
well create a HomePageController to handle it. Remember that although
the 'normal' thing to do is to have one controller per model (eg
PostsController <=> Post), this is not a rule, by any means, and you
can just set the uses() member of the controller to access whatever
models you need.

If the home page displays a certain set of data, just edit the
routes.php config file to redirect it to the appropriate controller -
for example

Router::connect('/', array('controller' => 'news', 'action' =>
'latest'));

Would display the same page as /news/latest

Hope this helps

grigri

On 16 May, 07:13, bittersweet <[EMAIL PROTECTED]> wrote:
> This is my first time to use cakephp to write web apps. My question is
> for the home page of a site, what controller does it go with? I'm
> asking because I need to write some logic (retrieve data from DB)  in
> the home page.
>
> Thanks in advance,


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