Login   Register  
PHP Classes
elePHPant
Icontem

XTemplate: Template engine for PHP

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author Author  
Picture of barnabás debreceni
Name: barnabás debreceni <contact>
Classes: 1 package by
Country: Hungary Hungary
Age: ???
All time rank: 5655 in Hungary Hungary
Week rank: 1790 Down18 in Hungary Hungary Down


  Detailed description   Download Download .zip .tar.gz  
Template engine for PHP that allows to store your html code apart from your php code. It was tested with php 3.0.11.

It features:

- Simple variable interpolation ( {STUFF} )
- Array variable interpolation for eg. {ROW.ID} {ROW.NAME} {ROW.WHATEVER}, you assign an array to the variable ROW once
- Global PHP variables available without making assigns for eg. {PHP.HTTP_HOST} {PHP.PHP_SELF} or any variable: {PHP.session_id}
- Assign using arrays for eg. $xtpl->assign(array(STUFF=>"kewlstuff",ROW=>$row));
- Default nullstring for unassigned variables and unparsed blocks, custom nullstring for every variable or block
- Dynamic blocks:
- Multiple level dynamic blocks (nested blocks)
- Autoreset feature (do not reset subblocks when reparsing parent block)
- recursive parse to parse all subblocks of a block
- File(template) include: {FILE "another.template.xtpl"}, the included templates can also contain includes recursively.. uses fopen so you can include http:// and ftp:// files too
- Very simple and powerful syntax, you'll love it :)

The code is very short and very optimized, according to my speed tests it's the fastest template engine around which can do nested blocks and variables..

The basic syntax is from FastTemplate and QuickTemplate (http://phpclasses.upperdesign.com/browse.html/package/49), but the entire class was written by me from scratch in one day, without a line from other
template engines. THIS IS NOT A REWRITE OF OTHER ENGINES!

The algorithm used makes this code amazing fast, you can do a bunch of nested dynamic blocks and everything you want, because it doesn't use recursive calls to build up the block tree.

Contains 7 examples (which covers all features i think), I tried to write them so even newbies should understand easily.

Docs and some functions i didn't need (clearing variables, etc) are still missing, but they'll come.

Current version is 0.2.4.

Licensed by LGPL.

WARNING: these files are outdated, the latest versions available from the project homepage: http://xtpl.sourceforge.net/

  Classes of barnabás debreceni  >  XTemplate  >  Download Download .zip .tar.gz  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: XTemplate
Base name: xtemplate
Description: Template engine for PHP
Version: -
PHP version: -
License: Unspecified (ask the author)
All time users: 4736 users
All time rank: 525
Week users: 0 users
Week rank: 1443 Equal
 
  Groups   Rate classes User ratings   Applications   Related pages   Files Files  

  Groups  
Group folder image Templates Template processing engines and components View top rated classes


  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Good (81%) Good (81%) - - - - Not sure (49%) 1680
Month: Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.
Add link image If you know an application of this package, send a message to the author to add a link here.

  Related pages  
Official Home of XTemplate
Official Site for XTemplate - Be sure to check it out it contains brand new version of this class!
http://freshmeat.net/appindex/2000/06/13/960897300.html
freshmeat entry for the class
XTemplate home
XTemplate home @ sourceforge

  Files folder image Files  
File Role Description
Accessible without login Plain text file description.txt ??? contains the description of the class
Accessible without login Plain text file ex1.p ??? example 1 (demonstrates basic features)
Accessible without login Plain text file ex1.xtpl ??? template file for ex1.p
Accessible without login Plain text file ex2.p ??? example 2 (demonstrates nested blocks)
Accessible without login Plain text file ex2.xtpl ??? template file for ex2.p
Accessible without login Plain text file ex3.p ??? example 3 (demonstrates autoreset)
Accessible without login Plain text file ex3.xtpl ??? template file for ex3.p
Accessible without login Plain text file ex4.p ??? example 4 (demonstrates recursive parse)
Accessible without login Plain text file ex4.xtpl ??? template file for ex4.p
Accessible without login Plain text file ex5.p ??? example 5 (demonstrates SetNullString)
Accessible without login Plain text file ex5.xtpl ??? template file for ex5.p
Accessible without login Plain text file ex6.p ??? example 6 (demonstrates SetNullBlock)
Accessible without login Plain text file ex6.xtpl ??? template file for ex6.p
Accessible without login Plain text file ex7-inc.xtpl ??? needed by ex7.p
Accessible without login Plain text file ex7-inc2.xtpl ??? needed by ex7.p
Accessible without login Plain text file ex7.p ??? example 7 (demonstrates includes)
Accessible without login Plain text file ex7.xtpl ??? template file for ex7.p
Accessible without login Plain text file license.txt ??? GNU Lesser General Public License
Accessible without login Plain text file xtpl.p ??? XTemplate class file

Download Download all files: xtemplate.tar.gz xtemplate.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.