Vemplator v0.6.1
Started: 2005-11-06 Updated: 2008-01-09
Progress: 98%
Language: PHP5
OS: Web
License: MIT
Vemplator is PHP template engine that strives to be light-weight yet featured, and does quite well in only 200 lines of code. The template syntax is concise, and the code is written to be extensible.
It also aims to make MVC (Model/Vemplator/Controller) a reality. :-)
What is a Template Engine?
Template Engines are sometimes referred to as a Templator, Template Parser or Templating System. See my Website Templating Systems article.
Examples
Template Syntax and Features
(See the README to the right for more details)
- "Minimal keypress" template syntax
- Function and method calls
- Conditionals: if/else and switch statements
- Dot-notation for class member variables (customer.name)
- Associative and numerical arrays (row[0] and rows[1]['name'])
- Foreach looping over arrays (associative and numerically indexed)
- Includes (included templates are parsed and cached separately)
- Less bloath than Smarty and others
- Now even easier to extend
Details
- 220 lines of code
- Regular Expression matching
Notes
Documentation is incomplete, as it is lacking detailed usage information. However, included with the source is a sample file which should be of assistance.
Also, the folder that holds cached templates must be writable by your HTTP server.
Files
09 January 2008
Fix shortcomings with regular expressions that perform template compilation; they're now more concise and should match all possible combinations of array and object references, nested and otherwise.
See the CHANGES for more info.
vemplator-0.6.1.tar.gz
vemplator-0.6.1.zip
30 July 2007
Added support for method and function calls! Now users have no excuses against trying vemplator. :-) I came across a situation where having function calls made sense, so I had a change of heart. However, one still cannot modify variables from within the template. This also means I've done away with output modifiers, which were my previous "workaround" for not allowing function calls. I'm now striving to be a pragmatist!
Greatly cleaned up compilation logic. There's no longer a need for preg_replace_callback() which reduces complexity. The should also result in simpler and hopefully faster code.
Updated the example to highlight the new changes.
See the CHANGES for more info.
vemplator-0.6.tar.gz
vemplator-0.6.zip
28 May 2007
Now uses PHP's include path to find templates, which should be simpler than having to call a vemplator method to set the template path. I also added Output Modifiers which facilitate making simple function calls. For instance, you could add a modifer that will format decimal variables to the correct format for the current locale.
vemplator-0.5.tar.gz
vemplator-0.5.zip
30 Sept 2006
vemplator-0.4.2.tar.gz
vemplator-0.4.2.zip
6 Dec 2005
vemplator-0.4.1.tgz - Source code and (incomplete) documentation
28 Nov 2005
vemplator-0.4.tgz - Source code and documentation. Enhancement release.
6 Nov 2005
vemplator-0.3.tgz - Souce code and docs