Display Tutorials

  Home arrow Display Tutorials arrow Page 4 - 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 Class Skeleton

    (Page 4 of 9 )

    Now armed with the knowledge of how template files would be structured and how I wanted the interface to look, I could start constructing the skeleton of the class:

    class Page

    Page($template) {


    replace_tags($tags) {


    output() {


    The array $tags is keyed using the place holders and its values are the corresponding replacement data. The variable $page is used to store the page as it's being generated.

    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