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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With