[Zope] Re: Newbie Questions
Wade Leftwich
wade@okaynetwork.com
Sun, 3 Feb 2002 08:51:45 -0500
On Sunday 03 February 2002 01:13, you wrote:
> Date: Sat, 2 Feb 2002 18:15:03 -0600
> From: "Gary Learned" <learned@talentsinc.net>
> Subject: Newbie Questions
>
> [ snip ]
>
> 2. In the book, it mentions that Zope Templates have to be total and
> complete html documents. If I want to create separate items like banners
> and navbars that will get sucked into all pages, I assume that means
> they have to be methods that are somehow included into a template? In
> other words, you can't have a portion of a page defined as a template as
> I understand this.
> [ snip ]
You *can* create PageTemplates that are html fragments, then call them from
other templates. This is a legal PT:
<p tal:content="string:hello"/>
However, that's not necessarily a good idea, because it can lead you away
from one of the principal benefits of PTs, which is to separate presentation
from content and keep all the presentation stuff together in one page that
will make sense to a designer. So in the example above, I think you're much
better off calling a python script that just returns "hello", and have your
main template put it inside a <p> element.
For re-using pieces of presentation logic, use macros ("metal"), a bit
trickier than basic "tal" but very worthwhile.
-- Wade Leftwich
Ithaca, NY