Zope
  Home arrow Zope arrow ZPT Basics (part 1)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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

ZPT Basics (part 1)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 22
    2002-09-18


    Table of Contents:
  • ZPT Basics (part 1)
  • The Power Of Three
  • Practical Magic
  • Anatomy Lesson
  • Putting It All In Context

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    ZPT Basics (part 1)
    ( Page 1 of 5 )

    Contrary to what you might think, DTML isn't the only programming language available to you in Zope. Take a look at Zope Page Templates (ZPT), a template-based alternative that makes it easier for designers and developers to collaborate on Zope application development.Not too long ago, I introduced you to something called DTML, the Document Template Markup Language. I defined it as HTML on steroids, and spent lots of time and bandwidth showing you how it could be used to build complex Zope applications.

    DTML isn't the only thing Zope has going for it, though. Over the next few pages, I'm going to introduce you to a brand-spanking-new creature from the Zope stable. It's called Zope Page Templates, or ZPT, and it's rapidly overtaking DTML as the de-facto standard for developing applications in Zope.

    The Zope Web site is pretty wordy when it comes to describing ZPT. It defines ZPT as "a consistent, XML compliant, markup language [which] embed[s] all logic in namespaced attributes ...and provide[s] a means to supply prototypical content to give the presentation designer a sense of context." Or, to put it in simpler terms, ZPT allows Web developers greater flexibility in separating an application's presentation layer from the business logic that drives it, thereby making it possible to easily update one without disrupting the other.

    I'm going to show you how in the following pages. Before I begin, though, make sure that you have a working copy of Zope and ZPT (this tutorial uses Zope 2.5.0, which comes with ZPT built in), and can log in to the Zope management interface. In case you can't, drop by http://www.zope.org/, get yourself set up and come back when you're ready to roll.{mospagebreak title=The Right Choice} Let's start with a very basic, but important, question: why use ZPT when you can use DTML?

    There are a couple of reasons why you might prefer to use ZPT instead of DTML. First, DTML isn't really all that friendly, even to developers who are used to wading in the muddy waters of open-source programming languages. The language comes with numerous idiosyncrasies, which can be both annoying and confusing to developers. For example, the result value obtained from a DTML variable often depends on the manner in which it is accessed, and the connectivity between DTML and Python can often leave you confused and desperately searching for a Python programmer to help you get unstuck.

    In addition to the technical problems with DTML, it's also not perfect when it comes to separating business logic from interface code. Since DTML documents contain both HTML code and DTML commands, interface designers and developers must collaborate closely with each other whenever a change needs to be made to the interface or processing sequences within a DTML document. Obviously, this means more time and effort to implement changes.

    ZPT attempts to resolve this last problem by using templates to separate presentation and layout information from program code. This two-tiered approach affords both developers and designers a fair degree of independence when it comes to maintaining a Zope application, and can substantially reduce the time and effort required in the post-release phases of a development project.

    Does this mean DTML is now redundant? No, not really. ZPT should not be considered a replacement for DTML; rather, it should be treated as an alternative to DTML. There still are some things that can be handled only using DTML - sending mail, managing sequences, batching and so on. If you're planning on working with Zope, you're going to need to keep your DTML skills current. It's just that you now have a little more choice.

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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT