promotion

Friday, February 20, 2015

How to create a static page in cakephp?

Here is the simple way to create static page.
  1. First create page with .ctp extension(static pages should be created with .ctp extension) and save in app/views/page folder. Ex: file named as sample.ctp
  2. Add rewrite URL in routes.php (app/config/routes.php).
Router::connect('/sample/', array('controller' => 'pages', 'action' => 'display', 'sample'));

That's it. Now you can access your sample page at www.yoursite.com/sample

No comments:

Post a Comment