Display Tutorials

  Home arrow Display Tutorials arrow Page 3 - Writing a Template System in PHP

Writing a Template System in PHP
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 69

    Table of Contents:
  • Writing a Template System in PHP
  • The Implementation
  • The Template File
  • The Class Skeleton
  • Constructor and Output
  • Replacing Tags
  • Including Dynamic Files
  • The Final Code
  • Tricks



    Writing a Template System in PHP - The Template File

    (Page 3 of 9 )

    Before I could start scripting my templating engine I first needed a template file. Not only would the template file be the cornerstone of the entire site, but it would also dictate how the class should be written.

    Though I could have chosen any set of characters to delimit my placeholders, I chose braces because they seem to be the ones most commonly used in other templating scripts. This would hopefully make template file sharing easier in the future.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

        <meta http-equiv="Content-Type" 
              content="text/html; charset=iso-8859-1" />
        <link rel="stylesheet" href="css/mystyles.css" 
              type="text/css" />
        <div id="banner">
          <img src="images/logo.png" alt="Main Logo" />
          <div id="menubar">
        <div id="leftcol">
        <div id="rightcol">
        <div id="main">

        <div id="footer">

    More Display Tutorials Articles
    More By bluephoenix

    blog comments powered by Disqus


    - Smart Auto Refresh
    - Writing a Template System in PHP

    Developer Shed Affiliates


    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap