[ZDP] dtml sucks ?

David Kankiewicz kankie@thegrid.net
Thu, 16 Mar 2000 12:32:56 -0800


Ulf Byskov wrote:
> 
> Zope is nice but dtml sucks ?

Yeah, we've heard this a couple of times.

> 
> I am a newbie trying to learn to use Zope however I am an experienced
> programmer
> who knows several different languages (like many other programmers).
> when someone
> wants to learn a new language it is important that there is some decent
> documentation.
> 
> At first sight dtml doesn't look like a language, but just a bunch of
> strange tags embedded in html.
> But it is a language after all since it features stuff like:
> 
> <dtml-if .........>
>     <dtml-call "REQUEST.set('my_var', 'my_value')">
> <dtml-elsif>
>     I got the value: <dtml-var my_var>
> </dtml-if>
> 

Actually its best described as a **reporting language**, most of the
complex stuff should be done in *python*. Were you have exernal methods,
python methods (in the cvs version or downloadable product), or straight
products.


> What the Zope documentation is seriously lacking (in my opinion) is an
> entry point to dtml

The documentation is being worked on painfully slow....


> having c, c++, basic etc. programmers in mind.
> 
> What a programmer usually wants to know when learning a new language is
> :
> 1. What variable types are available

Lookup python's and the tutorials on zope.org for html form
name:types:stuff...
see http://www.zope.org/Members/Zen/howto/FormVariableTypes


> 2. How do I create variables and how do I access them (keywords:
> passing, global, hieracy, namespace, scope)
Again the tutorials are the best source for this that is available, if
you working with simple web REQUEST variables otherwise lookup python.

> 3. How do I create functions and other structures and how do I access
> them

Python, if you really want to make it the smart way. or the maintenance
will kill....

but some neat little stuff is being done to help with dtml, I really
like the DTMLTemplete product's ideas...

> 4. Other syntax related stuff
> 
> I can see that some docs on this are available but they are so badly
> structured that it is too hard to find what you need.
> As it is right now you have to read quite a lot (docs and mailing-lists)
> to do things.
> 
> I am writing all this because I had some simple problems.
> 
> For example:
>     How do I create a variable in one method and how do I access it in
> another ?


Most of dtml is meant to handle simple display and is tied to the idea
of server side / html client form posting/processing. It can do almost
anything but it won't look nice!


In one DTMLmethod/doc you would set a REQUEST variable
<dtml-call "REQUEST.set('my_var', 'my_value')">

And after calling it in another DTMLmethod/doc, The one that is acting
as your HTML/something page.
<dtml-var above_dtml_method>

<dtml-var my_var> #is available.

and if you pass and set a variable when calling the DTML method.
<dtml-var "above_dtml_method(my_name='DK')">

you don't have access to the namespace unless you pass the namespace:

<dtml-var "above_dtml_method(_.None, _, my_name='DK')">
see http://www.zope.org/Members/teyc/howtoDtmlCall
or others tutorials...

> 
> This should be rather simple, but I still don't know how to do it !
>  It should be one of the first things to explaing before you are
> introduced to the <dtml-var ...> tag
> 
> What I am asking would probably take less than half hour for an
> experienced Zope developer to explain
> and write (at least point 1 and 2).
> 
> I hope that someone is listening !
> 
Well, it's always an issue with open source products. A commercial
product developer has more reasons to make One Bundle and have
everything in it. With an open source product, its always in development
and has a community (Zope has a great one!) that usually helps newbies.
You've got to love the number of downloadable products, though!


regards,
David