Reputation: 4038
I have just successfully installed CakePHP and I see that I can edit the home.ctp
view but is there a default controller for the index page?
To change the content of this page, create: APP/views/pages/home.ctp.
To change its layout, create: APP/views/layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.
Upvotes: 12
Views: 22987
Reputation: 738
If you want to make modifications to this controller it is recommended that you copy the default
cake/libs/controller/pages_controller.php to app/controller/pages_controller.php
The reason is because you should not modify anything inside the "cake" folder where any file can be overwriten when updating your application with the latest cakephp version.
Upvotes: 23
Reputation: 81721
You can change the default behavior by changing the Route::connect()
function arguments such as below:
Router::connect('/', array('controller' => 'requests', 'action' => 'index', 'home'));
and also if you want to connect all the actions to one action, use the code below in the same config file:
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Of course you should change the arguments to your own needs.
This configuration is located under app/config/routes.php
.
To get more information about Route::connect()
, visit this page: http://api.cakephp.org/class/router#method-Routerconnect
Upvotes: 13
Reputation: 31191
Yes, the default controller is PagesController, located in:
cake/libs/controller/pages_controller.php
Upvotes: 7