PHP
  Home arrow PHP arrow Page 2 - Template-Based Web Development With pa...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Template-Based Web Development With patTemplate (part 1)
By: Team Melonfire, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2002-05-28

    Table of Contents:
  • Template-Based Web Development With patTemplate (part 1)
  • Hard Sell
  • Message In A Bottle
  • Slice And Dice
  • Music To Your Ears
  • Watching The Clock
  • A Bookworm In The Ointment
  • A Rose By Any Other Name...

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Template-Based Web Development With patTemplate (part 1) - Hard Sell


    (Page 2 of 8 )

    patTemplate is a PHP-based template engine designed, in the author's words, to "help you separate program logic or content from layout". Developed by Stephan Schmidt, it is freely available for download and is packaged as a single PHP class which can be easily included in your application.

    patTemplate uses templates to simplify maintenance of PHP code, and to separate data from page elements. It assumes that a single Web application is made up of many smaller pieces - it calls these parts "templates" - and it provides an API to link templates together, and to fill them with data.

    In patTemplate lingo, a "template" is simply a text file, typically containing both static elements (HTML code, ASCII text et al) and patTemplate variables. When patTemplate parses a template file, it automatically replaces the variables within it with their values (this is referred to as "variable interpolation"). These values may be defined by the developer at run-time, and may be either local to a particular template, or global across all the templates within an application.

    As you will see, patTemplate also makes it possible to "nest" one template within another, adding a whole new level of flexibility to this template-based method of doing things. By allowing you to split up a user interface into multiple smaller parts, patTemplate adds reusability to your Web application (a template can be used again and again, even across different projects) and makes it easier to localize the impact of a change.

    As if all that wasn't enough, patTemplate also makes it possible to hide or show individual sub-templates, to repeat templates as many times as needed, to iteratively build templates, and to use conditional tests within a template. Since it's not HTML-specific - your template can contain code in any format you like - it can even generate output in ASCII, CSV or XML.

    Before proceeding further, you should visit the patTemplate home page at http://www.php-tools.de/ and download a copy of the latest version (2.4 at the time of writing). The package contains the main class file, documentation outlining the exposed methods and variables, and some example scripts.

    More PHP Articles
    More By Team Melonfire, (c) Melonfire


     

       

    PHP ARTICLES

    - Viewing and Editing Tasks for a Project Mana...
    - More on Private Methods with PHP 5 Member Vi...
    - Adding Tasks to a Project Management Applica...
    - Utilizing Private Methods with PHP 5 and Mem...
    - Making Changes in a Project Management Appli...
    - Defining Public and Protected Methods with M...
    - HTML for a Project Management Application
    - Using Subclasses and Accessors with Member V...
    - Implementing Internet Protocols with PHP
    - Project Management: The Application
    - Working with Private Properties to Protect P...
    - Protecting PHP 5 Class Data with Member Visi...
    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway