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

Let Me In - Zope

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

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
You've just seen how to push existing objects to the top of the namespace. But what if you want to create a new DTML object or variable? How do you push that newly-minted variable in to the DTML namespace?

The <dtml-let> tag is designed for just this kind of thing. Here's an example:

<dtml-let me="'John Doe'" > I am <dtml-var me>. </dtml-let>
The output of the script is pretty obvious:

I am John Doe
The <dtml-let> tag has been used to push a new variable, "me", to the top of the namespace. You can now access the value for this variable without even passing it as part of the query string. This is an effective way of debugging complicated DTML methods which require numerous parameters in the form data; just push them on to the namespace using the <dtml-let> tag, test your code, and, once you're done, delete the <dtml-let> tag!

You can also push objects on to the namespace. As an example, consider the process of pushing the GetUsers() ZSQL Method on to the namespace:

<dtml-let users=GetUsers> <dtml-in users> <dtml-var sequence-number>. <dtml-var Title> <dtml-var FirstName> <dtml-var Surname> - <dtml-var Email> </dtml-in> </dtml-let>
This example pushes the sequence returned by the GetUsers() ZSQL methods on to the namespace. The new "users" variable can then be processed as usual with the <dtml-in> tag.

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

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

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: