[ZPT] Web Design with ZPT

Joel Burton joel@joelburton.com
Sat, 2 Mar 2002 09:51:32 -0500 (EST)


On Sat, 2 Mar 2002, Joseph Griffin wrote:

> Good Morning,
> I have been listening in on a discussion in the Zope mailing list about ZPT
> vs. DTML and have been thinking - How far can you take the "write once/use
> everywhere" philosophy with ZPT? Do you guys develop a template that is
> global to the website and have areas where modifications are base on
> location? Could you not then put all the javascripts in one location? You
> know, now that I think about it, it seems that this is not emphasize in the
> Zope Documentation. Am I off base here? Thanks Joseph

ZPT can include acquired content, so if you have your JavaScript in a
DTMLDocument or File object, you could include this with <script
tal:content="here/javastuff">... javascript goes here</script>. Exactly
like DTML.

ZPT also has METAL, a macro language. Here, you can define "macros" in a
ZPT and have these macros become templates in another ZPT. This has
advantages in some cases--if you have a macro for the page structure, when
someone edits your index.html in a GUI editor, they'll be able to see (but
not change) the common headers, footers, etc.

Figuring out when to use which of these ideas is part of the getting zen
of ZPT.

All of this is explained well in the 2.5 version of the Zope Book.

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant