[Zope] Easy DTML way for layout.

Joel Burton joel@joelburton.com
Sat, 9 Mar 2002 11:19:16 -0500 (EST)


On Sat, 9 Mar 2002, Kees de Brabander wrote:

> Give each page a property 'pagenumber' containing -you guessed it- its
> pagenumber, create a list 'pages' consisting of all your pagenumbers and use
> something like:
> <dtml-in pages>
>   <dtml-if "_['sequence-item'] == pagenumber">
>     <b>page <dtml-var pagenumber></b>
>   <dtml-else>
>     page <dtml-var pagenumber>
>   </dtml-if>
> </dtml-in>
>
> hth, cb

Another possibility is to handle this w/site structure:

Suppose you have a site with the following folder structure:

|- About
  |- Mission
  |- Legal
|- Products
  |- Transmorgrifier X500
|- Customer Service
  |- Returns

Rather than marking every page (Mission, Legal, etc.) with a property for
what section they fall in, you can simply put the changable parts in their
folders. So, you'd have:

/standard_html_header:

  <html><body><table><tr><td><dtml-var toolbar></td></tr><tr><td>

and in /about/toolbar:

  You are in ABOUT

and in /about/PRoducts:

  You are in PRODUCTS

and so on. This way, you're using the structure of your site and
acquisition to provide the navigation feel you want.


If you don't want to have different toolbar methods in each folder, you
could put it in the standard_html_header, and have it figure out where you
are by examining the REQUEST.PARENTS object, which lists the parents of
the called object. This way, it could handle different appearance
differently without having to store a property with every object in the
site (which can get hard to maintain.)


I prefer the acquisition choice, though. More Zope-like and more flexible.

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant