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

Call Of The Wild - 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


DTML also offers a way to call other DTML methods from within your code, via the <dtml-call> construct. This comes in particularly handy when you want to invoke a method, but aren't really all that concerned about displaying the results of that method to the user - SQL queries are a prime example of this.

Consider the following example, which demonstrates:

<dtml-var standard_html_header> <dtml-call addMovieToCollection> <h1>Movie <dtml-var name> has been added to your DVD collection!</h1> <p><a href="listMovieCollection">List Movies in your Collection</a></p> <p><a href="addMovieForm">Add Movies</a></p> <dtml-var standard_html_footer>
In this case, I've called the addMovieToCollection() Z-SQL method. This method adds a record to the table containing my DVD collection. However, since I don't really need to worry about the return value, I can use the <dtml-call> tag to invoke the Z-SQL method.

Note also that I am not explicitly passing any parameters to the Z-SQL method. In this scenario, Zope take cares of extracting the required data from the REQUEST namespace and passing the parameters to the invoked method automatically. Isn't that neat?

There is a caveat, though - invoke the same method in an expression, and your workload increases. Why? Because now it's up to you to pass the parameters to the method explicitly.

>>> 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: