Zope
  Home arrow Zope arrow Page 5 - DTML Basics (part 4)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ZOPE

DTML Basics (part 4)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 5
    2002-07-17


    Table of Contents:
  • DTML Basics (part 4)
  • With Or Without You
  • A Polite Request
  • Let Me In
  • Climbing A Tree
  • The Real Thing
  • Call Of The Wild
  • The Writing On The Wall
  • Endzone

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    DTML Basics (part 4) - Climbing A Tree
    ( Page 5 of 9 )

    One of the most striking features of the Zope Management Interface is the navigation menu that appears on the left side. And the cool thing is, Zope comes with a built-in construct that allows you to replicate and use this tree structure for your own purposes. It's called the <dtml-tree> tag - and here's what it looks like:

    <dtml-tree> <dtml-var getId> </dtml-tree>
    This is a very simple implementation of the <dtml-tree> tag...as you can see from the output below:



    Here, the <dtml-tree> tag dynamically searches for the objects in the current folder and lists them by ID. It is obvious that, by default, it lists only the folders in the current location.

    Now, let me make the example more interesting:

    <dtml-tree branches_expr="objectValues()" sort=id> <dtml-var getId> </dtml-tree>
    Here's the output:



    I now have a listing of all the objects in the current folder along with a neat little icon that allows downward traversal. Give it a shot and you'll see that you can now see all the objects under the current folder.

    <dtml-tree branches_expr="objectValues()" sort="id">
    The additional "branch_expr" attribute of the <dtml-tree> tag is used to specify the expression that will be evaluated by Zope to display the listing of the objects in the tree. The "sort" attribute tells Zope to sort the list by ID.

    Want to play around with the code shown above? Just add the "reverse" attribute:

    <dtml-tree branches_expr="objectValues()" sort="id" reverse>


    Here's a brief list of the most useful <dtml-tree> attributes - try them at your leisure:

    "header" - this allows you to specify a DTML document that will be displayed as a header for each expanded node.

    "footer" - this is similar to the "header" attribute explained above, as it allows you to specify the footer for each expanded note.

    "nowrap" - set this to true if you want to truncate the nodes if there isn't enough space to expand them.

     
     
    >>> More Zope Articles          >>> More By Harish Kamath, (c) Melonfire
     

       

    ZOPE ARTICLES

    - Creating Zope Products
    - Plone Content Types With Archetypes
    - Flat User Management in Zope
    - Creating Basic Zope Applications
    - Getting started with Zope for Linux and Sola...
    - ZPT Basics (part 4)
    - ZPT Basics (part 3)
    - ZPT Basics (part 2)
    - ZPT Basics (part 1)
    - Exception Handling In DTML
    - DTML Basics (part 4)
    - DTML Basics (part 3)
    - DTML Basics (part 2)
    - DTML Basics (part 1)
    - Using Zope With Apache





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek