[ZPT] PageTemplates 1.3.1

Evan Simpson evan@digicool.com
Tue, 29 May 2001 15:09:03 -0500


From: "Peter Bengtsson" <mail@peterbe.com>
> Can I install ZPT 1.3.1
> and use the latest TAL and ZUtils on
http://www.zope.org/Members/4am/ZPT

Yes, those versions of TAL and ZTUtils are fine.

> DTML:
> <dtml-with subfolder>
>   <dtml-if anotherpageobject>
>     <tr>
>         <td><dtml-var "anotherpageobject.title"></td>
>         <td><a href="<dtml-var "anotherpageobject.absolute_url()">"
> title="<dtml-var "anotherpageobject.title">"><dtml-var
> "anotherpageobject.title"></td>
>     </tr>
>   </dtml-if>
> </dtml-with>

ZPT:
<tr tal:define="obj subfolder/anotherpageobject | nothing; title
obj/title | nothing"
      tal:condition="obj">
  <td tal:content="title">Title</td>
  <td><a tal:attributes="href obj/absolute_url; title="title"
              tal:content="title">Title</a>
  </td>
</tr>

> How can ZPT beat DTML then? This is important, because speed is very
> important.
>
> How do you write "fast" ZPT pages? (a style guide)
>
> Do you think ZPT will be faster than DTML (or nearer)?

Page Templates will certainly come close to DTML in speed.  The only
advice I can give with respect to speed is to make a local variable for
any path that you use several times (as with "title" in the example
above).

Cheers,

Evan @ digicool