What is the best way to structure a php website?

  • Thread starter Thread starter Treyford
  • Start date Start date
T

Treyford

Guest
My current setup consists of having a single index.php page that uses include() to pull in a header, menu, footer and content from other files that I can easily change for a site-wide update. However, for my content include I am using a switch statement that reads the variable in the address bar and pulls the appropriate content page from another directory.
For example: "mysite.com/?page=home" would look at the page variable and a switch statement would match page with home and pull in the home content file.

But, as you can imagine... it is time consuming to add all those cases to a switch statement every time you want a new page.

What is the best way to do this and still have just 1 index file?
 
Back
Top