PHPTAL is a PHP implementation of ZPT work. To be short, PHPTAL is a XML/XHTML template library for PHP.

While most web developpers continue to use ASP/JSP/PHP tags as the core language of their templates, the Zope community came with a refreshing idea named TAL. The idea was to move presentation actions inside XHTML attributes instead of using plain tags or elements.

Let's start with a simple PHP exemple (usually reproduceable in ASP/JSP):

<?php foreach ($values as $value): ?>
<div class="item">
  <div class="title">
    <?php if ($value->hasDate()): ?><?=$value->getDate()?><?php endif; ?>
    <a href="<?= $value->getUrl() ?>"><?=
  <div class="content">
    <?= htmlentities($value->getContent()) ?>
<?php endforeach; ?>

Let's have a look at the TAL way:

<div class="item" tal:repeat="value values">
  <div class="title">
    <span tal:condition="value/hasDate" tal:replace="value/getDate"/>
    <a tal:attributes="href value/getUrl" tal:content="value/getTitle"/>
  <div id="content" tal:content="value/getContent"/>

Now it's up to you to choose which version you prefer. Of course those tal:condition, tal:replace and tal:repeat may looks strange when begining with TAL.

Just for fun let's modify this example:

<div class="item" tal:repeat="value values">
  <div class="title">
    <span tal:condition="value/hasDate" tal:replace="value/getDate">
    <a href="sample.html"
      tal:attributes="href value/getUrl"
      My item title
  <div class="content" tal:content="value/getContent">
    This is a sample content which is replaced by the
    real content when the template is run with real

More in the manual.

Some PHPTAL advantages and features:

Some PHPTAL drawbacks: