Simple PHP template

6 Comments    February 25, 2006 01:05


Have you ever wondered how to create a simple PHP template for using on your web site? This tutorial will explain the concept and in the end you will see some code examples. The concept of templates is that from one simple index file we include some other file based on GET variables
. If you don’t know what a GET variable is this tutorial may be over your head and I suggest you learn this otherwise
.

The advantage of using templates are:

  • Easy to maintain
  • Easy to change design
  • Consistent look

Here are the simplified code for index.php



// Code for including css file
...


// Code for menu etc.





All you need to do now is create the individual pages
. If you want additional pages all you have to do is create a link in the menu and make an include statement in the switch block

acceptability. Additionally, new treatment options thatCardiac Status Evaluation What is sildenafil?.

. The pages should only contain text and/or html, all the styling should be in a css file included in the index file.


  6 Comments   Comment

  1. 19 years ago  

    This is a great site for PHP help. Thank you so much for the content is not priceable! This will help me a ton

  2. rso

    18 years ago  

    try to add break statement…then this example will be more functional.

  3. jack

    16 years ago  

    this does work, works like a charm. the only thing is it needs you to add one thing to the code: after every case ‘blah’: include(“blah.inc”); statement you need to add a break; statement to stop all of your included files appearing at once.

    once i added that i found that this little wedge of code does pretty much everything i was hoping. might need to investigate possible abuses of the $_GET variable but they’re probably quite easy to resolve.

    good job whoever came up with this 😀

    jack

Leave a Comment

You must be logged in to post a comment.