Display Tutorials

  Home arrow Display Tutorials arrow Page 4 - Writing a Template System in PHP
DISPLAY TUTORIALS

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

    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

  •  
     

    SEARCH CODEWALKERS

    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:

    <?php
    class Page
    {
      var 
    $page;

      function 
    Page($template) {

      }

      function 
    replace_tags($tags) {

      }

      function 
    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

    DISPLAY TUTORIALS ARTICLES

    - Smart Auto Refresh
    - Writing a Template System in PHP

    Developer Shed Affiliates

     



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