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

    Table of Contents:
  • DTML Basics (part 1)
  • Upper Management
  • Dissecting DTML
  • Of Methods And Madness
  • Introducing Yourself
  • Green Cheese And Pink Frogs

  • 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 1) - Green Cheese And Pink Frogs
    (Page 6 of 6 )

    You can also format variable values with DTML's numerous formatting attributes. Consider the following DTML Document, which contains a simple HTML form.

    <html> <head></head> <body> <form action="FormatForm" method="post"> <input type="hidden" name="someString" value="the cow jumped over a hunk of green cheese, and a pink frog turned into a hummingbird"> <input type="submit" name="submit" value="Hit Me!"> </form> </body> </html>
    Once this form is submitted (to another DTML Document instance named "FormatForm"), the form variables and their values become available within the Zope namespace. Here's what FormatForm looks like:

    <html> <head></head><body>Look how big I am:<br><dtml-var someString upper>.<p>Don't cut me off when I'm talking:<br><dtml-var someString size="14" etc="..."><p></body></html>
    It isn't very hard to guess what this script does:



    The <dtml-var> tag comes with a bunch of attributes designed to format the data within it. Here are the important ones:

    capitalize - uppercases the first character of the variable;

    upper - uppercases the entire variable;

    lower - lowercases the variable;

    size - restricts the number of characters of the variable that are displayed;

    etc - displays a string following the variable.

    You can also format the display of the DTML variables using "structured text", which, according to http://www.Zope.org/Members/millejoh/structuredText, is "...text that uses indentation and simple symbology to indicate the structure of a document". Or, in other words, structured text is a set of predefined rules that Zope understands and can use to automatically format your document for you.

    In order to see how this works, add the following line of code to the form above,

    <input type="hidden" name="someOtherString" value='"Liked this? Send me mail", mailto:neo@theone.com'>

    and the following line to the form processor:

    <dtml-var someOtherString fmt="structured-text">

    Here's what the revised output looks like:



    As you can see, Zope uses its structured text rulesets to automatically hyperlink the text string to the email address specified.

    I'm not going to get into the details of structured text here - there are some great references out there, with my personal favourite being the one at http://www.zope.org/Members/redsea/Wiki/StructuredTextRules. Play with it, and you'll get the hang of it soon enough.

    In the meanwhile, I'm out of here. But fear not - your journey into the wild and wacky world that is DTML has just begun, and I will be back with more next week, complete with maps and lollipops. See you then!

    Note: All examples in this article have been tested on Linux/i586 with Zope 2.5.0. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

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