[Zope] Templates a step backwards?

Jeff Peterson jpeterso@rangebroadband.com
Thu, 3 Jan 2002 18:07:06 -0600


> What I'm not sure about is page templates.  Are they really a good
> option, if you can life without WYSWYG editing?  I mean, surely they're
> a step backwards, in that every page has to basically be a working
> document.  Doesn't that bring in redundancy, with multiple pages holding
> the same basic layout, and having the potential to get out of sync?  If
> not, then great -- I'll look forward to using them.  But in that case,
> what have I missed?

Macros.  They allow you to pull out the redundant code and reuse it.  The
page template expands them automatically, making them stand on their own as
working documents.

Just create a master template, define a macro, give it a name put in your
code and call it in your template.

[master - Macro Template]
<div metal:define-macro="foo">
  <markup></markup>
</div>

[Calling Template]
<span metal:use-macro="here/master/macros/foo"/>

This will then expand when compiled giving you something like this:

<div metal:use-macro="here/master/macros/foo">
  <markup></markup>
</div>

The upside for me is, ZPT is clean, every page shows you what is happening,
no need to go from method to method tracking through what you've done to
track down a chunk of code.  Plus it has a consistency to it as well, which
I like.

--
Jeffrey D. Peterson
Webmaster
Range TV Cable & Broadband
1818 E. 3rd Ave.  Hibbing, MN 55746
jpeterso@rangebroadband.com