Zope
  Home arrow Zope arrow Page 5 - DTML Basics (part 4)
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
ZOPE

DTML Basics (part 4)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Dell PowerEdge Servers

    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

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway