I´m starting to developing with cake php. I have designed a DB model and baked my mvc´s.
Now i want a index / home site. This site should be an overview of possible actions which a user can do.
Should I use an app_controller for that or route to an existing controller even if that controller has nothing to do with a home site, or should I use a separate controller with no model just for displaying the overview and edit the route of / to point at this new Home Controller?
Whats the best practice for that?
Your question is a little vague to me. I am going to assume that by “site” you mean “page”.
If by “overview of possible actions which a user can do” you mean a static page with links, then use the provided
PagesController, and create a view atapp/views/pages/home.ctp.If by “overview of possible actions which a user can do” you mean a dynamic page with links and data, then create a controller action to feed the page the correct data.
Where that controller action goes should depend on where the data comes from.
If it lists the latest posts, create a
PostsController::home()action.If it needs data from the
Usermodel in order to determine what to display, then create aUsersController::home()action.Finally, if you are mixing data from many models with no clear winner, or you are actually creating a home “site” instead of a “page”, create a
HomeControllerorDashboardController.Read this post by
teknoidfor a nice succinct way of loading in arbitrary models when needed.