Zope
  Home arrow Zope arrow Page 2 - DTML Basics (part 2)
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 Developerworks
 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 2)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2002-06-05

    Table of Contents:
  • DTML Basics (part 2)
  • If Only...
  • Comparing Apples And Oranges
  • Welcome To The Matrix
  • Celluloid Dreams
  • Paring It Down
  • Deeper And Deeper
  • Submitting To The King

  • 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 2) - If Only...
    (Page 2 of 8 )

    The first - and simplest - decision-making routine isthe "if"statement, which generally looks like this:

    <dtml-if id>
    do this!
    </dtml-if>
    The "condition" here refers to a conditional expression, which evaluatesto either true or false.

    Let's look at a piece of code to understand this better. Here's a DTMLMethod named "ifOnly", created in the same "DTML Basics" folder I usedlast time.

    <dtml-if id>
    <p>Variable "id" exists and has the value <dtml-var id>.</p> </dtml-if>

    <dtml-if myName>
    <p>Variable "myName" exists and has the value "<dtml-var myName>".</p>
    </dtml-if>
    Now, when you view the output of this Method, you should see thefollowing:

    Variable "id" exists and has the value DTML Basics.
    If you take a close look at the code above, you'll see that it includestwo "if" statements; however, only one is displayed in the output. Thisis because the first statement evaluated to a true value, because thevariable "id" exists and has a value (the name of the container withinwhich the DTML Method is stored). However, the second DTML variable"myName" does not exist. As a result, the corresponding "if" statementevaluates as false, and so, the text enclosed within the<dtml-if> blockis not displayed.

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