PHPTAL
PHPTAL is a templating engine for PHP5 that implements brilliant Zope Page Templates syntax:
<div class="item" tal:repeat="item itemsArray">
<span tal:condition="item/hasDate" tal:replace="item/getDate"/>
<a href="${item/getUrl}" tal:content="item/getTitle"/>
<p tal:content="value/getContent"/>
</div>
PHPTAL is fast thanks to compiled templates and fine-grained caching. Makes it easy to generate well-formed XML/XHTML. It's free under LGPL license.
See the introduction.
News
PHPTAL 1.1.12 released
New RepeatController by Iván “DrSlump” Montes:
- based on SPL iterators (to simplify the code),
- added support for string iteration,
- added support for
letterandromanproperties, - added support for grouping
firstandlastproperties, - most properties are computed as needed.
PHPTAL is now easier to use as part of a framework or a plug-in:
- Required files are included from directory pointed by
PHPTAL_DIRconstant (it's defined automatically). This makes it easier to use multiple copies of PHPTAL, and eliminates need forinclude_path. - Configuration can be changed without using constants (patch by Werner):
$t = PHPTAL::create('index.html') ->setPhpCodeDestination('application/tmp/') ->setPhpCodeExtension('tmp') ->setForceReparse(true) ->set('title', 'My Title') ->set('heading', 'My Heading');
These changes are backwards-compatible: PEAR installations are unaffected, configuration constants are still supported.
PHPTAL 1.1.11 released
Handy feature, less bugs.
nothingorNULLas last alternative intal:attributeswill cause attribute to be omitted entirely,- support for systems on which
sys_get_temp_dir()does not include trailing slash, - fixed warning when clearing cache.
PHPTAL 1.1.10 released
Hello! My name is Kornel Lesiński and I'm the new maintaner of PHPTAL.
The latest release adds more robust error handling and integrates PHPTAL a bit better with PHP SPL:
- added support for
CountableandArrayAccessSPL interfaces, - added support for superglobals in
php:TALES expressions, - changed default temp directory to use
sys_get_temp_dir(). If this causes trouble, you can override it usingdefine('PHPTAL_PHP_CODE_DESTINATION','/tmp/'); - added additional safety-checks to code generation and macro execution to prevent invalid templates from triggering PHP errors,
- fixed small bugs in XML parser,
- fixed few error messages to be more precise and report proper file/line,
- changed all exceptions thrown by PHPTAL to inherit
PHPTAL_Exception.
pear upgrade http://phptal.motion-twin.com/latest.tar.gz
PHPTAL 1.1.9 released
Applied patch from Kornel Lesinski
- Added
phptal:cachethat caches HTML of any given tag, - Added
phptal_tale()which returns chained TAL expressions as a single PHP expression. It's quivalent to phptal_tales(), but can be used in more contexts (i.e. ${foo | bar}), metal:fill-blockcan fill blocks in parent contexts,- slightly improved runtime error messages.
Other svn pending fixes:
- fixed "not" bug with complex php: expressions,
- fixed tales string backslash escaping,
- fixed only escape < and > in PCDATA,
- fixed
php:$fooexpression which is evaluated tophp:${foo}equals$ctx->{$ctx->foo}.
As annonced on the mailing like I don't have the time to maintain PHPTAL anymore, Kornel Lesinski kindly proposed himself to take the head of the project and we will plan the hand over during the following weeks. It was a pleasure to give this library to the community!
Thanks to all PHPTAL users, Laurent Bedubourg
pear upgrade http://phptal.motion-twin.com/latest.tar.gz
PHPTAL 1.1.8 released
Fix and patch release
- applied
tal:repeatpatch from Moritz Bechler - applied
talesregistry patch from Moritz Bechler - applied memory patch from 'smoking_birds_on_moon'
- fixed
${structure foo}and${string:hello world} - fixed
setTemplate()reset existing prepared template (but not the context) - added
true:modifier support - added
structuresupport total:attributes
pear upgrade http://phptal.motion-twin.com/latest.tar.gz
PHPTAL 1.1.5 released
The 1.1.4 testing is stable and was improved :
- added:
PHPTAL_CommentFilteras a simple and usefull demonstration filter - added:
PHPTAL_PHP_CODE_EXTENSIONconstant based on William Bailey proposal - added:
MyClass.myStatic:custom expression modifiers (patch from William Bailey) - fixed: ;; bug in string: expressions (patch from William Bailey)
- some manual documentation concerning
local and globalkeywords
Important: tal:define now fully support global and local take a quick look at the manual for tal:define usage...
pear upgrade http://phptal.motion-twin.com/latest.tar.gz
English manual corrections
Many thanks to Dan Sheppard.
PHPTAL 1.1.4 (testing) released
The 1.1 branch has finaly been released, here are some changes :
- added:
globallocalkeywords total:define - fixed: many little errors in the i18n extension
- fixed: last path in
string:not interpolated - modif: XHTML empty attributes are now echoed with a value (ie:
checked="checked") - fixed: tal:define and content buffering fixes (patch from William Bailey)
- fixed: pre filter usage on external macro execution
- misc: many code refactorings which will lead to a radical library simplification in the future.
pear upgrade http://phptal.motion-twin.com/testing.tar.gz
PHPTAL 1.0.10 latest link fixed
The latest phptal download link was broken and linked to 1.0.9 release, this is now fixed.
pear upgrade http://phptal.motion-twin.com/latest.tar.gz
PHPTAL 1.0.10
(bug fix release before 1.1 branch)
- fixed: echoing an object now calls its
__toString()method - fixed: false booleans are now echoed as 0 instead of '' (css using
item/repeat/oddmay require an update) - fixed:
tal:content,tal:replaceandtal:attributeschained expression now ignoresnull,falseand'' - fixed:
<!-- -->comments were evaluating${foo} - fixed:
$${foo}were evaluated inside text nodes - fixed: doctype and xml declaration discovery inside deep macro calls
- fixed:
filemtime()warning when usingsetSource()with no path
pear upgrade http://phptal.motion-twin.com/latest.tar.gz
PHPTAL 1.0.9
- when
use-macroanddefine-macroappear in the same tag, slots are shared between macros to allow macro inheritence - added
PHPTAL::stripComments($bool)which removes xml comments during parsing - fixed '0' tag content unexpected behaviour (patch from William Bailey)
- more tests, minor refactorings and code comments
The next release will include many refactorings which will allow coders to "easily" insert their own namespaces and attributes into PHPTAL.
Pupeno's article (part2) in PHP|Architect
Pupeno's (Jose Pablo Ezequiel Fernandez Silva) second article was published on the april 2005 issue of php|architect.
This article explains common PHPTALES usage and goes deep into websites internationalisation using PHPTAL and gettext.
PHPTAL 1.0.8
- fixed bug with
array/0pathes (patch from William Bailey) - fixed stupid lt,gt,eq,... replacement in php:'string not gt foo'
PHPTAL 1.0.7
- added template string execution
PHPTAL::setSource($src, $path=false) - fixed
tal:attributesand zero values error - latest release is now reachable at http://phptal.motion-twin.com/latest.tar.gz
PHPTAL manual v1 released
The new PHPTAL for PHP5 manual is available. Corrections, remarks and translations are welcome (join the mailing list).
Pupeno's article in PHP|Architect
Pupeno's (Jose Pablo Ezequiel Fernandez Silva) first article about PHPTAL was published on the issue 3, volume 4 of php|architect.
This article introduces PHPTAL and explains most common TAL attributes with some good examples.
More articles should follow in next issues concerning advanced PHPTAL usage in daily applications.
PHPTAL 1.0.6
ChangeLog:
- fixed empty tags (link, input, ...) with XML output
- minor PHP transformer optimisations
- xml parser stricter about attribute value quotes
PHPTAL 1.0.5
ChangeLog:
- Important fix regarding attributes priority
PHPTAL 1.0.4
ChangeLog:
- Byte Order Mark removed from templates sources (still requires some tests)
- Replaced
htmlentities()usage byhtmlspecialchars() - Added
PHPTAL::setTemplate()methods which allow later template source selection.
PHPTAL 1.0.3
ChangeLog:
- fixed
*:blockwithi18nerrors.
PHPTAL 1.0.2
Changelog:
- fixed xml declaration with doctype clash
- added support for XMLNS aliases
PHPTAL 1.0.1
PHPTAL for PHP5 lost its dev status.
PHPTAL_Filter: allows the creation of pre and post filtersPHPTAL_Trigger: works withphptal:idand can be used to implement fine-grained cache systems.
More documentation to come.
PHPTAL hosted on motion-twin.com
As planed some times ago, i moved PHPTAL on one of my company's servers.
Expect more frequent updates and releases.
Also changed :