neobie
neobie

Reputation: 2910

CakePHP: changing default view instead of home.ctp

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.

Upvotes: 8

Views: 18076

Answers (1)

dhofstet
dhofstet

Reputation: 9964

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'));

Upvotes: 19

Related Questions