[Zope-CMF] Newbie question. - Templates

Dieter Maurer dieter@handshake.de
Tue, 24 Apr 2001 20:49:31 +0200 (CEST)


Hi Charles,

Charles Hall writes:
 > Thanks Dieter, what you describe is exactly what I was looking for. Unfortunately I couldn't find any examples of what you're describing on the web site. I read many pages of detailed DTML specs. but never made it to any editting tool. It's possible it's there and I missed it.
In your original post you asked for templates where the blanks are
filled in by authors.

In the HTML world something with blanks in it is called a form.
You do not need Zope to build forms: any HTML editor will
do.

When the form is submitted, it will go to a Zope object
(probably either DTML or Python Script). Zope
nicely presents the form variables. If your form has
a control (aka form variable) with name 'xxx',
then in DTML, you can access it via

     <dtml-var xxx>
or inside an expression with

     "... xxx ..."

As we assume that your form is used to describe content,
the object should either build a new object or update
an existing one.
You would have a Content Class with the correct slots
(to be filled with the content items).

Creating a new object looks like (in DTML, similar in Script):

	 <dtml-with "manage_addProduct[<product_name>].<constructor>(parameters)">
	   <dtml-call "manage_changeProperties(REQUEST)">
	   ....
	 </dtml-with>

Updating just uses the "manage_changeProperties" (or something similar)
in the correct context.


Last step is presenting your content.
Again you have a template with wholes in it.
In the most trivial form, your wholes are simply names of slots
of your object. This again can be designed with a standard
HTML editor.
Then comes a nasty step (it will disappear with the ZPT (Zope
Presentation Templates), say in about 6 to 12 months).
You need to transform you passive HTML into DTML.
In the trivial cast mentioned above, this means
replacing the splot names with "<dtml-var slotname>".
It can be automated, if your names are appropriately
decorated.
When you activate this DTML object in the context of one
of your content objects, it will presents this by
filling the wholes with the slot content of the document.

 > I don't know if you have any input to the Zope web site designer, but to me it's all topsy-turvy.
I am not sure.
When the designer wants just to choose from predefined templates,
then the CMF does not have many, currently.
When he is ready to make his own designs and can cooperate
with someone with some programming skills
(able to "include" (dtml-var), "choose" (dtml-if), "iterate" (dtml-in)"
knowing about 20 most relevant functions, ...),
then the CMF can provide great playing grounds for real projects.

 > I noticed that on the CoFax site the template stuff is right up front. I guess the Zope audience is mainly programmers, while the CoFax audience is people trying to get out tomorrow's paper!
Zope's CMF is incredibly young.
There are not yet the masses of templates (probably they will never
be, because the primary Zope users would always want to do
something themselves).

Maybe, you come back in some months.
Then ZPT should be ready. It, too, would probably not provide
a wealth of templates but would allow you to use
professional XHTML design tools to create your own
templates and let them interact relatively easy with Zope.


Dieter