New features:
-------------
$Id: news.txt 322 2004-10-28 15:51:30Z schst $
New features in v3.1.0:
- allowed more than one namespace
- added defaultFunction option, to define a function that is called for unknown functions
- added new built-in condition __single
- allow quoting variables using \{FOO\}
- implemented autoload in Call function
New features in v3.0.0:
1. Features
-----------
The following features are new to patTemplate since version 3.0.0
1.1 Improved reader
The reader now accepts tags and data or even several tags in one line.
1.2 New architecture
patTemplate is now split into several different modules. This allows
you to load components at runtime and keep the main codebase small.
The available modules are:
1.2.1 Reader
Splitting the template reader from the main class has several advantages:
* Read templeates not only from file but from any datasource. Readers for
files and strings have been implemented already.
* Read different template types. Currently patTemplate shippes with a reader
that is able to read templates that have been created for PEAR's
HTML_Template_IT. As PHPLib uses the same template format, it is also possible
to work with templates created for the PHPLib templating system.
1.2.2 Dump
As the dump() functionality is split from the main engine, it increases performance.
1.2.3 TemplateCache
1.2.4 Input Filter
1.2.5 Output Filter
1.2.6 Custom Functions
1.2.7 Variable Modifiers
1.3 New Tags
1.3.1
1.3.2
1.4 Modulo Templates
Modulo templates are similar to OddEven templates, but you may define how many
different sub-templates you need.
1.5 Flexible Namespace
It's possible to change the namespace of patTemplate, simply
use the new method setNamespace()
1.6 Several new features for variables
1.6.1
patTemplate 3 introduces the tag that introduces new
features:
* default value for a variable
* copy the value of a variable
* apply a modifier to a variable (PHP function or custom object)
* Do not display, but calculate (could be used to count the chars of
any variable and store the result in another variable that is
used as a condition variable)
1.6.2 Multi-dimensional arrays
You may now pass a multi-dimensional array to patTemplate and the engine
will add the variables in the array to the child-templates.
1.7 Support for user-defined tags
You may define any tag and register a PHP class that will create the
HTML code that will be inserted.
1.8 Dynamic includes
It is now possible to change the source of an external file at runtime.
You'll have to add autoload="off" to the template and then use
$tmpl->setAttribute( 'tmpl', 'src', 'myFile.tmpl' ) to change the file that
should be included.
1.9 Misc other features
* new built-in conditions __odd, __even, __first, __last,
__default and __empty
* new attribute 'addSystemVars'
* it's possible to add variables before reading a template
prepareTemplate( string tmpl ) must be called for that.
* external templates will be loaded when needed
2. PHP-API
----------
2.1 New methods
---------------
2.1.1 patTemplate::addObject( string template, object obj [, string prefix] )
This allows you to add any PHP object to a template. In the template, all
properties of the object are available as template variables.
Optionally it is possible to specify a prefix.
2.1.2 patTemplate::parseIntoVar()
2.1.3 patTemplate::setNamespace( string namespace )
Allows you to change the namespace for the patTemplate tags.
2.1.4 patTemplate::readTemplatesFromInput()
2.1.5 patTemplate::setRoot( string root )
2.2 Deprecated methods
----------------------
You should not use the following methods.
2.2.1 patTemplate::setBasedir()
Please use setRoot() instead.
2.2.2 patTemplate::readTemplatesFromFile()
Please use readTemplatesFromInput() instead