Zope
  Home arrow Zope arrow Page 2 - 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 
IBM Rational Software Development Conference
 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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    DTML Basics (part 4) - With Or Without You
    (Page 2 of 9 )

    We'll begin with something interesting. Create a DTML Document named "WithOrWithoutYou" and insert the following code.

    <b> The value of "id" is <dtml-var id><br> The value of "icon" is <dtml-var icon><br> The value of "me" is <dtml-var me> </b>
    Now, call this script with three parameters, like this:

    http://localhost:8080/DTML%20Basics/WithOrWithoutYou?id=1234&icon=folder &me= John
    In other words, I'm explicitly passing it values for the "id", "icon" and "me" variables. But when I view the output of the script, I see something completely different:

    The value of "id" is WithOrWithoutYou The value of "icon" is misc_/OFSP/dtmldoc.gif The value of "me" is John
    Of the three values passed, only one appeared correctly. How come?

    Take a look at the variable names used in the example. While the third one does not ring a bell, the first two are among the default properties associated with each and every Zope object.

    Now, if you go back a little, you'll remember a little thing called acquisition, a concept I took great pains to explain - basically, the process by which Zope tries to find a value for a variable. As I said before, Zope will first look for the variable value in the current folder and then traverse upwards to the root folder in search of it. If it is still unsuccessful, it looks in a couple of other places for the missing information; these places include cookies and form data sent using POST or GET methods.

    Now, the entire gamut of objects and locations listed above represent a nebulous entity that Zope refers to as the "namespace". By default, Zope places some default objects in this namespace when it starts up. Subsequent objects are added to this "stack" as and when they are invoked.

    Consequently, when you load the DTML Document above, it is pushed to the top of the namespace stack along with its "id" and "icon" properties. When DTML tries to replace the value of the variables "id" and "icon" in the DTML Document, it encounters these two properties at the top of the namespace stack before even getting around to looking in the query string (which are always located at the bottom of the namespace stack). Which explains why the values passed on the query string never show up in the output of the script.

    That said, since no value exists for the variable "me" in the namespace stack, Zope will finally get around to looking in the GET query string, locate the variable value and print it.

    Obviously, this behaviour isn't always what you want. Which is where the <dtml-with> tag comes in.

    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 4 hosted by Hostway