HTML_Template_Sigma pear.php.net An implementation of Integrated Templates API with template 'compilation' added HTML_Template_Sigma implements Integrated Templates API designed by Ulf Wendel. Features: * Nested blocks. Nesting is controlled by the engine. * Ability to include files from within template: <!-- INCLUDE --> * Automatic removal of empty blocks and unknown variables (methods to manually tweak/override this are also available) * Methods for runtime addition and replacement of blocks in templates * Ability to insert simple function calls into templates: func_uppercase('Hello world!') and to define callback functions for these * 'Compiled' templates: the engine has to parse a template file using regular expressions to find all the blocks and variable placeholders. This is a very "expensive" operation and is an overkill to do on every page request: templates seldom change on production websites. Thus this feature: an internal representation of the template structure is saved into a file and this file gets loaded instead of the source one on subsequent requests (unless the source changes) * PHPUnit-based tests to define correct behaviour * Usage examples for most of the features are available, look in the docs/ directory Alexey Borzov avb avb@php.net yes 2014-01-13 1.3.0 1.2.0 stable stable PHP License * Implemented a more robust cache writing algorithm, this should prevent writing empty cache files and reading incomplete ones (bug #19220) * Got rid of deprecated 'e' modifier for preg_replace(), preg_replace_callback() is now used instead (bug #20068) * Fixed built-in 'j' callback to allow using escaped strings in inline JS * Updated code to better conform to PEAR coding standards * Updated code and tests to generate fewer errors under PHP5 * The minimum PHP version is now 4.3.0, as file_get_contents() is used 4.3.0 1.5.4 ctype 1.2.0 1.2.0 stable stable 2008-07-22 PHP License Changed unit tests to use current PHPUnit from http://www.phpunit.de/ rather than old unsupported one from http://pear.php.net/ Implemented parts of request #12221 (thanks to Carsten Wiedmann for ideas and their initial implementation) * It is now possible to add comments to the template file that are removed from output: <!-- COMMENT --> ... <!-- /COMMENT --> * Added new builtin callbacks 'e' and 'r' for htmlentities() and rawurlencode(), respectively * Added the 'charset' option for builtin 'h' and 'e' callbacks 1.1.6 1.1.5 stable stable 2007-05-19 PHP License Migrate to package.xml version 2.0, use proper header comment blocks. Minor fixes to phpdoc comments, no code changes since previous release. 1.1.5 1.1.5 stable stable 2006-05-31 PHP License Fixed bug #6346: typo in _buildFunctionList() Fixed bug #6902: correctly handle drive letters and path separators on Windows Fixed bug #6905: use 'b' modifier for fopen() to prevent problems with cached templates on Windows Calling setCacheRoot() with an empty argument will now disable caching. It was impossible to disable it with previous behaviour. Added possibility to pass arrays as second arguments to setVariable() and setGlobalVariable(), this will assign values to placeholders of the form {varName.arrayKey} in the template. Thanks to Franz Pentenrieder <franz at quox.net> for idea and original implementation. 1.1.4 1.1.2 stable stable 2005-11-05 PHP License Fixed bug #5168: Prevent problems with template functions in included files 1.1.3 1.1.2 stable stable 2005-08-09 PHP License * Fixed bug #4896 (loading a zero-length template file caused a warning) * Fixed bug #5012 (placeholder delimiters were hardcoded in several places, which prevented using custom delimiters) 1.1.2 1.1.2 stable stable 2004-10-20 PHP License Changed the code for parsing template function arguments. It will now correctly unescape the escaped quotes within quoted arguments (see bug #1840). The new code throws errors on bogus arguments. If you previously relied on undocumented behaviour of argument parsing method, your code may break: test before upgrading. 1.1.1 1.1.1 stable stable 2004-05-31 PHP License Callbacks are not called if the block containing them is empty. Thanks to Sergey Vasiliev for the suggestion. 1.1.0 1.1.0 stable stable 2004-04-14 PHP License * Fixed #876 (get_class() and get_class_methods() usage with PHP5) Unit tests run on PHP5, all tests pass. * Added clearVariables() method (see also #939) * Added shorthand syntax for callbacks: {var:callback} instead of func_callback({var}) * Added builtin callbacks 'h' for htmlspecialchars() 'u' for urlencode() 'j' to escape the string for usage in Javascript This release is dedicated to Lukas Smith 1.0.2 1.0.1 stable stable 2003-10-02 PHP License * Removed _callbackExists() method, is_callable() is used instead * Check for SIGMA_OK instead of PEAR::isError() where possible * Fixed unit tests packaging. Should work OK in PEAR installation 1.0.1 1.0.1 stable stable 2003-05-20 PHP License * Added getBlockList() and getPlaceholderList() methods (thanks to Markus Wolff for the idea). * HTML_Template_IT compatibility: get() does not clear the parsed block contents by default. * Removed obsolete docs, current ones are in the PEAR manual. 1.0 1.0 stable stable 2003-04-28 PHP License This release has Sigma's template functions/callbacks infrastructure significantly enhanced. This unfortunately means some backwards compatibility breaks. If you were using callbacks before, please carefully examine the release notes and test you scripts before upgrading to 1.0. If you weren't using callbacks due to their shortcomings it is a good time to give them a try, consult docs/example_4.php for some of their possible applications. Template functions/callbacks changes and incompatibilities: * Templates are parsed for function calls not only on setTemplate()/loadTemplatefile(), but on addBlock()/addBlockfile() and replaceBlock()/replaceBlockfile() as well. * The arguments to template functions can now contain variable placeholders: func_uppercase('Hello, {username}!'). * Template functions are now compatible with template caching. * Method setCallbackFunction() now accepts a callback that is compatible with call_user_func() as its second argument. Its third argument is used to control variable substitution in function arguments. * Method performCallback() was removed. Callbacks are now called automatically when the block containing them is parse()'d. * Callbacks are now called via call_user_func_array() instead of call_user_func(). This makes it possible to use built-in functions as callbacks, but also means that you have to rewrite your old functions! * Usage example is available in docs/example_4.php Other changes: * Option 'use_preg' was removed. * Stricter error checking when doing addBlockfile() with a prepared template. 0.9.2 0.9.2 stable stable 2003-04-21 PHP License * Added usage examples * Added the cache FAQ * This is the last 0.9.x release unless some bugs are found. The 1.0 release will have callbacks significantly redone and will require changes to your scripts if you use callbacks. 0.9.1 0.9.1 stable stable 2003-04-18 PHP License * Fix: if source template does not exist, do not load the 'prepared' one, throw an error instead. Thanks to Maxim Panasiuk for the report. 0.9 0.9 stable stable 2003-04-04 PHP License Initial PEAR release