[Zope] PAL versus DTML

Paul Winkler pw_lists@slinkp.com
Thu, 9 Jan 2003 12:36:28 -0800


On Thu, Jan 09, 2003 at 02:54:13PM +0000, Raphael Arlitt wrote:
> But this generated code is not usuable and workable with WYSIWYG tools and
> hence PAL

"PAL"? I assume you mean TAL, part of the trinity (TAL / TALES / METAL)
that make up Zope Page Templates, aka Page Templates, aka ZPT.

> But how do I now modularize my site with PAL in the DTML way?

Be aware that every ZPT must be valid XML, so you can't do some
DTML-ish things such as put <html> in one template and the closing
</html> in another. This takes a bit of getting used to, but
it's really no bother. 

With that in mind, there are two ways I know to modularize your
templates: 

1) METAL macros.  This allows you to create complete viewable pages
and then insert bits of one page inside another page.
too lengthy for me to describe here, but you can quickly get the
idea from the Zope Book, chapter "Advanced Page Templates",
section "Macros":
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AdvZPT.stx


2)  <span tal:replace="structure here/name_of_other_template">
    </span>

This will replace the entire <span>...</span> with the result of rendering
my_other_template.  Roughly equivalent to <dtml-var my_other_template>.
This violates the everything-is-a-complete-page principle, but
I still find it useful.  Of course it can be any other html tag
besides <span>, and you can use tal:content instead of tal:replace
if you want to insert things without removing the enclosing tag.


-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's AMAZING SCARECROW!
(courtesy of isometric.spaceninja.com)