PHP MicroTemplate

PHP MicroTemplate 1.0.0

PHP MicroTemplate 1.0.0 Download Summary

  • Language: PHP
  • Platform: Windows / Linux / Mac OS / BSD / Solaris
  • License: LGPL - GNU Lesser General Public License
  • Databases: N/A
  • Downloads: 792
  • Released: Aug 15, 2007

PHP MicroTemplate 1.0.0 Description

This class provides an extremely fast, lightweight templating system for HTML and other text-based documents.

Like FastTemplate and its many clones, MTPL supports nested blocks and looping. However, the entire implementation is done without a single regular expression.

The PHP interpreter is leveraged for its built-in variable interpolation, and explode() is used to separate block markers from content using a simple delimiter. As a result, the overhead of reading and parsing template files is minimal. This should eliminate the need for a cache and improve the overall performance of template- driven sites.

Since PHP's dollar sign notation (ie. "$var") is used to identify content placeholders, it is sometimes necessary to escape dollar signs in your template (ie. "$$amount").

You can use arrays with the form $array[element]; just don't quote the index. $array['element'] or $array["element"] will generate PHP parse errors due to the way PHP evaluates hashes in a string context. For the same reason, multi-level arrays will not work ("$a[b][c]" becomes the value of $a[b] followed by the literal text "[c]").

Global variables can be accessed using the usual $GLOBALS[] array method. For instance, to get the script URL, you can use $GLOBALS[PHP_SELF].

There are a few other differences. The assign() method found in most PHP template classes is gone. Instead, all assigned variables must be provided as a hash that is passed to the parse() method.

Since in almost every single case a series of assign()'s is done followed by a single call to parse(), this eliminates some redundancy. It also provides a more strict scoping to template variables which should result in scripts that are easier to debug.

Two variations on parse() exist: parseLoop() and parseOut(). parseLoop() takes a list of hashes instead of a single hash of variables to assign and calls parse() on the same block for each.

This allows you to populate tables and drop-downs without the need to write loops into your code. parseOut() iteratively calls parse() for a given block and each of its parents in order.

For instance, parseOut('main.section.sub') will parse 'main.section.sub', then 'main.section', then 'main'. Both of these methods should reduce the amount of code you need to write for typical operations.

You will also notice that there is no out(), text(), or print() method. Rather than holding onto all output internally, the parse() and related methods return the resulting output. To output the result of a parse operation, simply: echo parse(...);

PHP's native error handling is used for all errors and warnings. In addition, by adding "error_handling(E_ALL);" to your scripts, the PHP interpreter will warn you about any uninitialized template variables.

Granted, the error messages are a bit odd (since interpolation is done inside of an eval()), but this can be a good way to track down typos.

PHP MicroTemplate Bookmark

Hyperlink code:
Hyperlink for Forum code:

PHP MicroTemplate 1.0.0 Script Download Notice

Top 4 Download periodically updates information of PHP MicroTemplate 1.0.0 script from the developer, but some information may be slightly out-of-date.

Our script download links are directly from our mirrors or publisher's website. PHP MicroTemplate 1.0.0 torrent files or shared files from free file sharing and free upload services, including Rapidshare, MegaUpload, YouSendIt, MailBigFile, DropSend, HellShare, HotFile, FileServe, MediaMax, zUpload, MyOtherDrive, SendSpace, DepositFiles, Letitbit, LeapFile, DivShare or MediaFire, are not allowed!

php arapi library

... The library currently supports data operations.php-arapi uses Remedy Template Library to access BMC Remedy AR System. The ... AR System either through function calls or via classes. Functions - arapi_initialization(,,), class construcor - arapi_termination() - arapi_setserverport(,,) ...

class xslt

This class is an abstraction class for an XSLT processor, it let's you setup the XML to be processed and the XSLT stylesheet to use from a file or a PHP string. This implementation uses the Sablotron XSLT processor and ...

PHPClass Generator

PHP Class Generator is a PHP Class Generator that generates SQL and PHP classes from a XML-file. ...

PHP HTMLTables

PHP HTMLTables is a set of PHP 5 classes used to generate properly formed HTML tables. This class will speed up the development of your websites. ...

PHP Progressbar

... for time consuming operations and loops in PHP.The class increases the timelimit for script-execution (if safe-mode is turned off), prevents a browser-timeout by sending pieces auf the progressbar to the browser and gives the user live-feedback on the progress of the running operation. ...