You are not logged in Log in Join
You are here: Home » Members » Coventry » DTML Syntax Extras

Log in
Name

Password

 
 

Folder icon DTML Syntax Extras

Getting tired of repetitive typing within Zope? ASP and JSP both use <tt>&lt;%</tt>, and php uses <tt>&lt;?</tt>, meanwhile Zope's <tt>&lt;dtml-</tt> is bulky! Here is my solution: '<:'

Also, The var tag can now be substitued with a =, leading to a ASP/JSP-esque syntax like: <tt>&lt;:= yourvar&gt;</tt> for direct variable/expression-value output. (only available in 0.3 and above)

I created this shorter syntax by editing DT_HTML.py & DT_String.py within my <ZOPEHOME>/lib/python/DocumentTemplate folder to add another form of DTML-tag syntax.
- This works with all existing and future dtml- and dtml-sql tags.

Note that applying this patch does NOT prevent the use of the old syntax(es); it only adds the new syntax, which can be used alongside of and mixed with the old syntax(es). Installing this patch will NOT break any existing pages or any installed products. (unless they have modified DT_HTML.py themselves, which they shouldn't do unless they modify/add to the DTML tag syntax anyway!)

An example:
<:if "foobar==grok">
  <:call "REQUEST.set(foobar, grok+1)">
</:if>
<:= foobar>

Note: If you are using the DTML-EVAL tag addon, it's patch for proper dtml-comment will be overidden unless you use version 0.4b. If you installed the DTML-EVAL tag after the extra syntax patch, the tag overwrote the code in DT_String.py to allow for the use of a = in place of var. to fix this, simply update to version 0.4b

 Title   Type   Size   Modified   Status 
 DT_HTML.py for Zope 2.2.4 Edit object Software Release   2001-01-10 published
 DT_HTML.py ver 0.1 for Zope 2.2.0 Edit object Software Release   2000-11-28 published
 DTML Syntax Extras (zope 2.2.5) Edit object Software Release   2001-01-21 published
 DTML Syntax Extras for Zope 2.3.0 Edit object Software Release   2001-01-27 published
 Extra DTML syntax for Zope 2.2.5 Edit object Software Release   2001-01-10 published
 Extra Syntax w\eval tag support (Zope 2.3.0) Edit object Software Release   2001-02-05 published