Home arrow Zope arrow Page 8 - DTML Basics (part 4)

The Writing On The Wall - Zope

In this concluding article, dip your toes in the waters of more advanced DTML programming, with explanations of the , and tags.

  1. DTML Basics (part 4)
  2. With Or Without You
  3. A Polite Request
  4. Let Me In
  5. Climbing A Tree
  6. The Real Thing
  7. Call Of The Wild
  8. The Writing On The Wall
  9. Endzone
By: Harish Kamath, (c) Melonfire
Rating: starstarstarstarstar / 5
July 17, 2002

print this article


Now, every major programming language comes with the capability to include inline comments in the code. And DTML lets you include meaningful comments in your code via the <dtml-comment> tag. Take a look at the tree example, now rewritten with lots of comments.

<dtml-tree branches_expr="objectValues()" sort="id" single="1"> <dtml-comment> check if the current item in the tree is a folder</dtml-comment> <dtml-if "meta_type=='Folder'"> <dtml-comment>If folder, just display the id</dtml-comment> <img src="<dtml-var icon>" > <dtml-comment>check if current item has been expanded</dtml-comment> <dtml-if tree-item-expanded> <dtml-comment> if expanded, display the id of the object in bold</dtml-comment> <b><dtml-var getId></b> <dtml-else> <dtml-var getId> </dtml-if> <dtml-else> <dtml-comment>if not folder, hyperlink the object so that it can be directly accessed by the user</dtml-comment> <img src="<dtml-var icon>"> <a href="<dtml-var tree-item-url>"> <dtml-var getId> </a> </dtml-if> </dtml-tree>
If you're planning to make your code publicly available on the Internet, a comment is a great way to tell members of the opposite sex all about yourself - try including your phone number for optimum results.

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- 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

Developer Shed Affiliates


Dev Shed Tutorial Topics: