Re: Newbie Questions
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
On Sun, Feb 03, 2002 at 08:51:45AM -0500, Wade Leftwich wrote:
You *can* create PageTemplates that are html fragments, then call them from other templates. This is a legal PT: <p tal:content="string:hello"/>
Ah, thanks, I was wrong. What I was thinking of is that page templates must be valid *xml*. That is, tags must be closed, tag nesting must be done correctly, etc... Which doesn't necessarily mean that you need an <html> or <head> tag, of course. My bad.
For re-using pieces of presentation logic, use macros ("metal"), a bit trickier than basic "tal" but very worthwhile.
Like the man said. -- paul winkler home: http://www.slinkp.com music: http://www.reacharms.com calendars: http://www.calendargalaxy.com
participants (2)
-
Paul Winkler -
Wade Leftwich