PHP Classes

XTemplate: Template engine for PHP

Recommend this page to a friend!
  Info   View files View files (19)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 48%Total: 4,759 All time: 577 This week: 164Up
Version License Categories
xtemplate 1.0Unspecified (ask ...Templates
Description 

Author

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/

Picture of barnabás debreceni
Name: barnabás debreceni <contact>
Classes: 1 package by
Country: Hungary Hungary
Age: ???
All time rank: 6226 in Hungary Hungary
Week rank: 312 Up6 in Hungary Hungary Equal

  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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,759
This week:0
All time:577
This week:164Up
User Ratings User Comments (1)
 All time
Utility:80%StarStarStarStarStar
Consistency:80%StarStarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:48%StarStarStar
Rank:2926
 
Overall, it was a very done package.
12 years ago (Rik Davis)
60%StarStarStarStar