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 can call your page like this: www.yourdomain.com/mypage

Leave a Reply

Your email address will not be published. Required fields are marked *