Stay tuned, don't forget the News Feed PHPTAL news - Atom feed

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.13 released

2008-07-27
  • New template cleanup routines based on patch by Sergio Chersovani and Nicola Aitoro. PHPTAL will now clean up all old template files and will recompile templates also when their timestamp changes to an older one.
  • Added support for PHP constants in TALES.
  • Improved parsing of XML with syntax errors after root node. If you start getting errors about text after root node, wrap your templates in a <tal:block> element.
  • Improved parsing of semicolons in PHP strings, tal:attributes and tal:define.
  • Fixed parsing of backslash escapes in TALES strings (bug reported by Josh Duck)
  • New configuration methods now work properly with external macros (bug reported by Philip Reichenberger)
  • Added workaround for protected __isset/__get (problem reported by Anru Chen)

PHPTAL 1.1.12 released

2008-04-17

New RepeatController by Iván “DrSlump” Montes:

  • based on SPL iterators (to simplify the code),
  • added support for string iteration,
  • added support for letter and roman properties,
  • added support for grouping first and last properties,
  • 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_DIR constant (it's defined automatically). This makes it easier to use multiple copies of PHPTAL, and eliminates need for include_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

2008-01-29

Handy feature, less bugs.

  • nothing or NULL as last alternative in tal:attributes will 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

2008-01-26

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 Countable and ArrayAccess SPL 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 using define('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

2007-11-25

Applied patch from Kornel Lesinski

  • Added phptal:cache that 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-block can 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:$foo expression which is evaluated to php:${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

2006-11-20

Fix and patch release

  • applied tal:repeat patch from Moritz Bechler
  • applied tales registry 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 structure support to tal:attributes
pear upgrade http://phptal.motion-twin.com/latest.tar.gz

PHPTAL 1.1.5 released

2006-04-09

The 1.1.4 testing is stable and was improved :

  • added: PHPTAL_CommentFilter as a simple and usefull demonstration filter
  • added: PHPTAL_PHP_CODE_EXTENSION constant 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 global keywords

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

2005-12-10

Many thanks to Dan Sheppard.

PHPTAL 1.1.4 (testing) released

2005-12-10

The 1.1 branch has finaly been released, here are some changes :

  • added: global local keywords to tal: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

2005-06-08

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

2005-05-22

(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/odd may require an update)
  • fixed: tal:content, tal:replace and tal:attributes chained expression now ignores null, false and ''
  • 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 using setSource() with no path
pear upgrade http://phptal.motion-twin.com/latest.tar.gz

PHPTAL 1.0.9

2005-04-23
  • when use-macro and define-macro appear 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

2005-04-22

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

2005-03-30
  • fixed bug with array/0 pathes (patch from William Bailey)
  • fixed stupid lt,gt,eq,... replacement in php:'string not gt foo'

PHPTAL 1.0.7

2005-03-29

PHPTAL manual v1 released

2005-03-27

The new PHPTAL for PHP5 manual is available. Corrections, remarks and translations are welcome (join the mailing list).

Pupeno's article in PHP|Architect

2005-03-22

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

2005-03-21

ChangeLog:

  • fixed empty tags (link, input, ...) with XML output
  • minor PHP transformer optimisations
  • xml parser stricter about attribute value quotes

PHPTAL 1.0.5

2005-03-15

ChangeLog:

  • Important fix regarding attributes priority

PHPTAL 1.0.4

2005-03-03

ChangeLog:

  • Byte Order Mark removed from templates sources (still requires some tests)
  • Replaced htmlentities() usage by htmlspecialchars()
  • Added PHPTAL::setTemplate() methods which allow later template source selection.

PHPTAL 1.0.3

2005-03-02

ChangeLog:

  • fixed *:block with i18n errors.

PHPTAL 1.0.2

2005-02-27

Changelog:

  • fixed xml declaration with doctype clash
  • added support for XMLNS aliases

PHPTAL 1.0.1

2005-02-25

PHPTAL for PHP5 lost its dev status.

  • PHPTAL_Filter: allows the creation of pre and post filters
  • PHPTAL_Trigger: works with phptal:id and can be used to implement fine-grained cache systems.

More documentation to come.

PHPTAL hosted on motion-twin.com

2005-02-25

As planed some times ago, i moved PHPTAL on one of my company's servers.

Expect more frequent updates and releases.

Also changed :

Valid XHTML 1.0! Valid CSS!