iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 13, 2008
I want to create a site just like ____, is that a violation of...
About
 
May 12, 2008
Film Makers, Bands and Comedians Welcome on MySpace
About
 
May 12, 2008
Software Engineering for Ajax
WebReference.com
 
May 12, 2008
What is the Head Tag For?
About
 
May 11, 2008
Improving accessibility for motor impaired users
WebDevTips UK
 
May 11, 2008
10 ways to orientate users on your site
WebDevTips UK
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /PHP /Templating

Making A Basic Templating System 

  Views:    7003
  Votes:    5
by Mark Klink 11/10/03 Rating: 

Synopsis:

What? You say you want to make a quick and easy templating system that has the ability to run your whole site? Well, then this article is for you.
Pages: firstback2 forwardlast
The Article

One of the most asked questions I get, is "How do I make a basic templating system in php?"  Okay, well it's not.  Actually the most common questions I get is, "Can you make a basic template system for me?"

While I have no problems helping people, and slaving for them all day long, there comes a time when you must teach a person to fish, rather than always catching the fis for them.

So here Goes

A One page template system

Now all though this is called a "one page" template system, it really doesn't use just one page.  It uses a total of 3.  The reason it's called a "One Page" system, is because "one page" does all of the work.  The files you will be creating are as follows:

  • index.php
  • template.html
  • content.php

You've guessed right, if you figured that content.php will be where all of your content is stored, template.html is your template, and index.php is the PHP script that puts them all together, and runs your site.

Now, there are many types of template systems.  However, they all have the same concept, and pretty much work the same.  The difference is, some template systems use a large number of pages, for each content portion of your site.  Since that system still leaves you to create a new page for each portion of your content, it's probably not as efficient.  So, for this article I'll stick with the One Page System.

So let's get started!

Pages: firstback2 forwardlast

Similar/related articles:


 
  Sponsors