SunQuest
 
       PEAR Articles
  Home arrow PEAR Articles arrow The PEAR ITX Templating System
Try It Free
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
IBM® developerWorks
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? 
PEAR ARTICLES

The PEAR ITX Templating System
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2003-01-08

    Table of Contents:
  • The PEAR ITX Templating System
  • Searching for solutions
  • Adding ITX to your PHP script
  • How to make templates
  • The conclusion

  • 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
     
    Try It Free
     
    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

    The PEAR ITX Templating System


    (Page 1 of 5 )

    An analysis of the ITX templating system included with PEAR.

    By : Ivan Stojic

    In this tutorial, I'll explain and demonstrate how to use the ITX templating system from the PEAR collection of useful classes for PHP. As we go along, I'll show you some of the competitors, why I didn't like them and why in the end I choose to work with ITX in my own scripts.

    We will build a simple example script that will load and fill out the data out of a database. This script will use another PEAR component, a database abstraction layer. If you are not familiar with PEAR's DB abstraction layer, I suggest you read up on that other tutorial :)

    How things used to be

    I started writing dynamic web applications back in 1997. PHP was in version 2 at that time, and wasn't yet called PHP, it's codename was FI. I never used it because I had a different toy.

    My primary interest at that time was to write simple Perl scripts that would be embeded in the HTML code by using server side HTML parsing. It was simple, it only supported several simple "include" oriented commands and at that time it packed a punch.

    Later on, I graduated to writing CGI applications. I started off with a pretty simple guestbook, and later progressed to message boards and similar simple user interaction scripts.

    But, through all that work, there was something missing...

    The need for clarification

    At the time I was still too inexperienced to realize that there was something wrong with my code. The wrong part was, of course the fact that I mixed markup and code freely and that my scripts were highly dependant on the look of the host HTML document.

    Every time the web site's look changed I had to go in and do the changes to the HTML that was printed from inside the script. This made workflow rather cumbersome because practicaly every designer had to have a programmer baby-sitting him.

    Furthermore, the applications were difficult to customize on a per-client basis, because only somebody with an above average skill could do all the needed changes.

    And finally the revelation

    By that time PHP3 was starting to kick up dust so I focused on learning it and using it more and more in my day-to-day work. I started playing around with various ways of abstracting the output from the scripts. First of all I realized that HTML and code shouldn't be in the same file - hence I started doing simple abstraction by using the include() function.

    The second idea was to separate some parts of the output from the scripts into configuration values. In that way, my users would edit only one configuration file and set various options. For instance, in my guestbook the administrator could specify what kind of HTML code would be printed before and after the sender's name, et cetera...

    More PEAR Articles Articles
    More By Codewalkers


       · For those interested in the integrated doc in the source code, you can find a phpDoc...
       · I've been struggling trying to get the phplib template system to work (with nested...
       · I've been using them for almost almost a year now. I was using PHPlib template.inc...
     

    PEAR ARTICLES ARTICLES

    - Using Web Service APIs (Amazon and Yahoo!) w...
    - Database Abstraction with MDB2 from PEAR
    - The PEAR Package Tour: PEAR Basics
    - Caching with PEAR::Cache
    - Introduction to PEAR
    - The PEAR ITX Templating System





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