Matt Slavin wrote:
> Hi,
> I am trying to use Zope to create a very simple company website (about
> 40 pages, or so) with the intention of having the flexibility to
> expand functionality etc in due course. I have very little Python /
> DTML experience,

Python is in itself pretty easy to learn. DTML is a pure horror IMHO,
and I avoid it by all means. ZPT (Zope Page Templates) are perhaps not
the simplest existing template solution, but combined with metal macros
and acquistion, it's a very powerful solution.

> but have managed to set up the site using
> includes on the main index page and then use aquisition to provide
> the content within each section.
> I'm not sure if this is a safe - or correct way of going about it, but
> it seems ideal for our purposes. The navigational menus dynamically
> include a link to each sub folder - ie website/services/ - and
> navigating to a section, index_html is automatically shown. The
> "mainContent" variable is then
> dynamically placed into index_html. (So there are separate
> mainContent dtmlDocuments in About Us, Services etc..) This means we
> can keep the content completely separate, and do not have to include
> headers, footers and other includes within the mainConte nt variable.
> Brilliant.
> However, when using the search script -
> - results return a link
> back to the dtml_Document file mainContent, which gets displayed
> without any of the header of footer information. Is there any way to
> render the page with header and footer info? (By, I guess, redirecting the
> page to the containing folder, so that it pulls out index_html instead...)

What I do is using ZPT and metal macros.

1/ I have one or more "master" page template(s) for the layout(s).
This|these template(s) define a a "page" macro at the beginning (before
the doc type declaration) and slots for the parts that are to be
overridden by other templates - one of these slots being the "main_content".

2/ then I have "content" page templates that callback on the appropriate
master template and fill in the needed slots

The whole thing relies on the Product used for content knowing how to
render in a page template (the EpozDocument product provides a good base
for this - don't be afraid, it's not that terrible).

A sample master template would look like this:

<metal:block define-macro="page">
<DOCTYPE ....>
  <title tal:content="here/title_or_id">title</title>
  <metal:block define-slot="meta"></metal:block>
 <div id="header">
  <metal:block define-slot="header">
  the standard header, can be overriden

  <div id="sidebar">
   <metal:block define-slot="sidebar">
   <div tal:replace="here/get_side_menu />

  <div id="main_content">
   <metal:block define-slot="main_content">
     this is the main content area, to be overriden

  <div id="footer">
  the standard header, can be overriden

And a (very simple) page template for a given content type could be
(assume there's a get_master_template method (ie python script or method
of the content product) that returns the appropriate master template):

<metal:block use-macro="here/get_master_template/macros/page">
<metal:block fill-slot="main_content">
<h1 tal:content="here/title_or_id">the title</h1>
<div tal:content="here/content">
 the real content

I did my first Zope site with this architecture and the EpozDocument
product for content pages, and it has proven to be a pretty
usable/maintainable/extensible solution.

bruno desthuilliers
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to