Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP: changing default view instead of home.ctp

Tags:

cakephp

As title, how can I change default view without placing home.ctp in apps/views/pages/ folder?

lets say, I want the default home page to show /views/other/index.ctp .

Where should I change the coding? which files does it involved? Thank you.

like image 725
neobie Avatar asked Feb 28 '11 05:02

neobie


1 Answers

Create an OtherController:

// app/controllers/other_controller.php
class OtherController extends AppController {
    public function index() {
        // do something
    }
}

and point the root route in app/config/routes.php to it:

Router::connect('/', array('controller' => 'other', 'action' => 'index'));
like image 154
dhofstet Avatar answered Oct 22 '22 19:10

dhofstet