[Zope] ZPT Newbie Question

Jose Gerardo Amaya Giron gamaya@aldeacentroamerica.com
26 Jul 2002 09:46:11 -0600


On Fri, 2002-07-26 at 09:21, Felix Ulrich-Oltean wrote:
> Look in the Zope Book :  http://www.zope.org/Members/michel/ZB
> 
> The chapter on Advanced Page Templates, as well as the Page Templates
> Reference will tell you how.  Of course you might want to read the
> chapter on Page Templates first.
> 
> But, basically, you define a macro in your source template by using
> something like:
> 
> <span metal:define-macro="usefulbit">This is a <b>useful</b> snippet
> that I can re-use elesewhere</span>
> 
> Then in your destination template, you write:
> 
> <span metal:use-macro="here/source_template.html/macros/usefulbit">
> default content
> </span>
> 
> Felix.

First of all thanks Felix for your reply. I ckeck the zope book and your
example, but I still have one more question. When I define a macro I can
add any ZPT code I want, I mean I can add code that calls SQL Methods,
scripts etc or is just for dtml code purposes. I mean just to reuse dtml
for looks or I can jsut for everything. Imagine I want to implement some
user control or get some user preferences from a database for each
template I have, can I include it in a macro and use it later on.

thanks in advance

Gerardo Amaya