PEAR Articles
  Home arrow PEAR Articles arrow Page 2 - The PEAR ITX Templating System
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 
JMSL Numerical Library 
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
     
     
    ADVERTISEMENT


    The PEAR ITX Templating System - Searching for solutions


    (Page 2 of 5 )

    I started searching for more mature templating systems. I didn't have an exact set of goals in mind, but I did know what I wanted to achieve: 1. Code clarity 2. Ease of template writing for my clients

    Here are the systems that I tried out while looking for The One Templating System :)

    XSL Transformations

    For those of you that don't know it yet, XSL is an XML application that focuses on formatting the contents of an XML document to anything you can think of. You could for instance, generate SQL queries or HTML.

    Unfortunately, XSLT wasn't what I was looking. My source code wasn't mixed into the HTML any more, but the code looked like hell. I wasn't generating HTML with echo() calls any more... I just switched over to generating XML with sprintf() calls and then using built in PHP functions to merge the XML and XSLT document into HTML.

    The second problem is only apparent when you see an example of an XSLT file. XSLT is an XML application. Therefore, every XSLT must comply to a strict set of rules. Even the smallest mistake will cause strange errors, unexplained problems and general buggery. XSLT also has dreams to be more than (in my oppinion) it needs to be, so the syntax is not something your average Joe L. User could easily understand.

    Smarty

    Now, Smarty is nice. It has a ton of features, most of which likely nobody ever uses. Of the better ones, I definitely need to mention template caching and an advanced support for built in template functions.

    I liked Smarty, but it still wasn't what I was looking for. It had too much stuff in it, when I only needed the simplemost templating that would get me through the project, so I kept looking.

    If you have a really large volume website, you could possibly benefit from Smarty's templating. On the other hand, I don't think you will. Smarty only supports age-based caching, and it uses plain files to cache documents.

    And finally... IT/ITX

    Integrated Template system and it's bigger brother Integrated Template eXtension are two of the scripts from the PEAR package.

    I was surprised by the apparent lack of good documentation pertaining to this templating system. Until I realized how to get this thing working, I've read the source for ITX several times. Most of the documentation was imbedded directly into the source and examples are... well... non-existant.

    Fortunately for me, something kept pushing me on to investigate, and in the end it turned out that ITX is exactly the thing I was looking for. It had support for blocks and variables, some primitive support for calling PHP functions directly from the template (if you ever find yourself in need of that) and a very easy template syntax for my users. I found this last feature more important than anything else that other templating systems could offer!

    Compared to Smarty, ITX is definitely smaller and lighter. Many things are missing, and yet I'd say that the thing most of the folks will find missing is caching. If you need caching you can still implement it with finer cache expiery methods than those of Smarty. I suppose there will also be a tutorial about ITX caching and cache control at some point in time.

    So, after this long introduction let's get down to business!

    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 XML_RPC2 with PEAR
    - 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