At 11/23/00 01:38 PM, Tom Deprez wrote:
>Are there some sites which publish there DTML source(structure)? I'm
>particulary looking on how several navigation, menu, ... structures are
>implemented in Zope.

I use the following DTML Method (probably shouldn't be done in dtml) to 
produce a vertical, indented menu where folders are expanded to subfolders 
only if you're in one of the subfolders. Three custom folders are used to 
build the site (Category-Top, Category-Middle, and Category-Bottom). Each 
folder has a menu_entry property. A folder appears in the menu only if its 
menu_entry is non-blank. If you are currently in Pop Culture/Reviews/Books, 
the menu looks like this:

Ask the Experts
Pop Culture

Here's the dtml. It's called display_menu and is recursive. Replace 
home_id_here with the id of the site's base folder. The base folder does 
not appear in the menu display.

  <dtml-unless topdown>
    <dtml-call "REQUEST.set('topdown',[])">
    <dtml-call "REQUEST.set('homefound','n')">
    <dtml-in PARENTS skip_unauthorized>
      <dtml-if "homefound == 'n'">
        <dtml-call "topdown.insert(0, _['sequence-item'])">
        <dtml-if "_['sequence-item'].id == 'home_id_here'">
          <dtml-call "REQUEST.set('homefound', 'y')">
    <dtml-call "REQUEST.set('level', 0)">
    <dtml-call "REQUEST.set('NodeToShow', topdown[0])">
  <dtml-if "level > 0">
    <dtml-with NodeToShow>
      <dtml-var "'&nbsp;'*3*(">
      <a href="&dtml-absolute_url;" class=toolbox>&dtml-menu_entry;</a><br>
  <dtml-if "level < _.len(topdown) and == topdown[level].id">
             sort=id skip_unauthorized>
      <dtml-if "_['sequence-item'].menu_entry">
        <dtml-call "REQUEST.set('level', level+1)">
        <dtml-call "REQUEST.set('NodeToShow', _['sequence-item'])">
        <dtml-var display_menu>
        <dtml-call "REQUEST.set('level', level-1)">

Not my finest piece of coding, but maybe it will help.

Dennis Nichols

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to