[Zope] A few questions from a newbie

Paul Winkler slinkp23@yahoo.com
Tue, 2 Oct 2001 15:10:35 -0400


On Tue, Oct 02, 2001 at 02:29:37PM -0000, azbok@yahoo.com wrote:
> 3) I read about Zope Page Templates (ZPL).  Should I just go with
> that and not bother with DTML?

It depends what you want to do. My own opinion:

Getting started quickly:

 	Doing simple things in DTML is really easy. 

	Simple things in ZPT tend to be a bit more wordy than in DTML.


Existing code:

 	Most of the Zope products out there use DTML, so there are a lot
	more examples. If you want to use other people's products you
	will probably have to learn a little DTML.


Readability:

	DTML gives you the impression that you can get by without learning
	a little python. This is, IMHO, an illusion that just leads
	you into trouble. You will inevitably start writing python
	expressions in your <dtml-if> or <dtml-let> tags, and you'll
	probably start doing it without really understanding what
	you're doing, or knowing what the "_" variable is.
	Many newbies are confused by the fact that in DTML, names in
	quotes are not the same as names outside of quotes.
	Everything in quotes is python, which is not self-evident.

	ZPT is much more explicit about this. ZPT pretty much expects
	you to use python for anything sophisticated. Python
	expressions in a ZPT document are easy to identify - they
	start with the word "python".


Web design tools:

	DTML uses proprietary tags that third-party web design applications
	will not understand. You can't easily edit DTML with
	Dreamweaver, GoLive, etc.

	ZPT is done with tag _attributes_, so a Page Template is valid
	XHTML. You can use your favorite design tool and it won't ruin
	your work. You can view the page outside of Zope and it'll
	actually look like something.


So overall, my advice is, if you have time, learn both. :)

And learn a little python. Here's a great python tutorial:
http://www.andamooka.org/reader.pl?section=thinkpython 

Depending on your prior programming experience, you can work through
that in a few hours or a few weeks. It'll teach you more than enough
python to write python expressions in DTML or ZPT, and you'll also be
able to write some Python Scripts to take complicated logic out of
your pages (a good idea).

The only time I'd suggest learning DTML but not ZPT is if you really
have a quick project, don't want to invest a lot of time in Zope, and
want to use a lot of other people's zope products. But don't be
surprised when DTML starts confusing the heck out of you.

I also highly recommend the ZDebug product,
http://www.zope.org/Members/hathawsh/ZDebug

It really helps make errors a lot more meaningful, especially for
DTML. It doesn't help much with ZPT unfortunately. :(


--
  ................  paul winkler ................
 custom calendars:   http://www.calendargalaxy.com
   A member of ARMS:   http://www.reacharms.com
        home page:  http://www.slinkp.com