Monday , 29 May 2017
Home » CakePHP » [CakePHP] How to Create Static Pages
[CakePHP] How to Create Static Pages

[CakePHP] How to Create Static Pages

I need to create a static pages along with other dynamic pages for my CakePHP site. Initially i have decided to go with a similar procedure as dynamic pages. But later i got the solution for Static pages that CakePHP provides a simple and easiest way to create Static pages. Follow the below steps to create static pages in CakePHP.

1) Go to views/pages directory
2) Create test.thtml file under pages folder
3) Access page by http://www.yoursite.com/pages/test

You don’t need to write any rotes rule to achieve this.

If you are in a situation to differentiate static pages into sub directory than follow the basic steps to create sub pages for static pages in CakePHP.

1) Go to views/pages directory
2) Create a sub folder(for e.g. sub1)
3) Create subtest.thtml file under sub1 folder
4) Access page by http://www.yoursite.com/pages/sub1/subtest

You are Done.

      
Plugin by: PHP Freelancer

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel working as PHP Programmer India. I have developed this site to share my knowledge, thoughts and experience during the development of projects. We are group of developers working together. If you want to hire us for any PHP related work, you can reach me via Email, Phone or Chat.

One comment

  1. What happens if you want to change your routes and you have pages/abc/xyz? I want to be able to create a friendly url that points to that view.

Leave a Reply

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

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.