How to create static page in CakePHP.

1. Under View > Pages create hello.ctp 2. Under Config folder open routes.php and add the following code: Router::connect(‘/hello’, array(‘controller’ => ‘pages’, ‘action’ => ‘display’, ‘hello’)); 3. Now open your static page via: http://yourdomain/hello

Creating page without Controller or Model in CakePHP

This is recommended if you’re not going to use database in specific pages. 1. Create page view in  /App/View/Pages/mypage.ctp 2. Copy the following codes to /App/Config/routes.php Router::connect(‘/mypage’, array(‘controller’ => ‘pages’, ‘action’ => ‘display’, ‘mypage”)); Note:  Just make sure the name of your page view from  /App/View/Pages/mypage.ctp is exactly the same name above from the code given. Now you[…]