PinoyTech.org

CodeIgniter, Kohana, Mootools, jQuery and CSS

How to Setup the Home Page on your CakePHP Application

Posted by teejay on March 19, 2009

Been playing a lot with CakePHP and I have been having fun.

After playing around my simple application, setting up controllers, views, models, authentication and lots of other stuff. I wondered, how to I ever change the home page content?

CodeIgniter allows you to change the default controller in the routes.php file. Kohana works similar.

However, CakePHP was a different beast. I never knew how to set this up and got up and researched. I found two good tutorials.

I ended up following the second one. Here's how I set it up.

Router::connect('/', array('controller' => 'blog', 'action' => 'index'));

I changed the controller index value, the action index value. Of course, it's absolutely necessary to have a method and a view corresponding to the controller and action or you'll get an error but it won't be hard to figure out.

Categories: How To, Web Development

Tags: cakephp

No Comments

Comments are not allowed