[Zope] Problems and ponderings
Rik Hoekstra
rik.hoekstra@inghist.nl
Wed, 5 Jul 2000 11:05:29 +0200
In my site I have folder with subfolders and I would like to generate
a menu to go to those subfolders.
What I have now is:
<dtml-in "objectValues()">
<dtml-var sequence-key>
</dtml-in>
which gives emptynes.. I've tried all kinds of combinations, tricks
from the tips and howto's, but nothing.
[rh]First, why do you use sequence-key? Use sequence-item instead
<dtml-in "objectValues()">
<dtml-var sequence-item>
</dtml-in>
second
Actually I start thinking that zope is not for me. Yes, I'm a
programmer, but here and now creating websites. I want to create a
website, not publish objects. An abstactionlayer between zope and
python would be a good thing. (and don't tell me DTML IS an
abstractionlayer. It confuses the matter, it doesn't simplify.
Including perl straight into the pages would be simpler. Not to
mention that Python is actually decently documented..)
[rh]No one will tell you DTML is ideal,. It's meant to be a presentation
language and for that it's powerful. If you want to write python inside
Zope - use PythonMethods.
If you really want to put perl into your webpages - there is PerlMethods
coming up, that presumably can do the same as PythonMethods.
Anyhow, I'm not giving up yet let's check my mental image:
A zope site is an tree of objects, objects inherrit from parents.
[rh]Yes, and they acquire from parents. Acquisition is a type of dynamic
inheritance
(how
do I check if a parent exists?) so there should be a way to refere to
the parent (PARENTS[]) to refer to the current object (?).
[rh]current object is this() for most purposes. I do not quite get what
you're aiming at. But the current object depends on the namespace and the
namespace is a stack determined by parents, using acquisition. Traversing
the namespace changing the current object, and so do dtml tags like dtml-in
and dtml-with. The best introduction to these is probably in
http://www.zope.org/Documentation/How-To/AdvancedDTML
I guess there should also be a way to refer to objects in an other
branch of the tree (I would like to have a tools folder which is also
searched when asking for a DTML-methode)
[rh]This can be accomplished (simply) by using
<dtml-with "<yourobject>.<yoursubobject>">
your code
</dtml-with>
or more directly
<dtml-var "<yourfolder>.<theobjectyouwant>()">
But there are many other methods of doing this in more sophisticated ways,
depending on your needs
Is my mental image to limited? Does it need adjusting?
[rh]it may need adjusting in your appreciation of Zope flexibility
Rik