Re: [Zope] A DTML problem using Namespaces

2000-10-08 Thread Dieter Maurer

tav writes:
    i have a dtml method called "parseit", and i have
  three dtml documents, called "tav", "noa" and "Bill".
   
  however i get stuck when in parseit, as i dont know how to do dtml-var
  Bill, i tried to set Bill in the namespace by using dtml-with
  Billdtml-var parseit, and then tried to call dtml-var id within
  "parseit" but that doesn't work :/
It does not work, because dtml-with Bill renders "Bill" (leading to
a string which does not have an attribute "id").
It will work, when you use:

dtml-with "Bill".../dtml-with

Note the "...". They prevent automatic rendering.

  and, again, i want this to be done automatically, so i dont want to have to
  manually list Bill, tav, noa, etc
This is an FAQ. You want computed variable access. You use
"_.getitem(...)" (if you want the object itself) or "_[...]"
(if you want a rendered result) for this.

Thus, if you want to process all owners, you could do:

dtml-in owners
  dtml-let owner=sequence-item
dtml-with "_.getitem(owner)"
  dtml-var parseit
/dtml-with
  /dtml-let
/dtml-in



Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] A DTML problem using Namespaces

2000-10-07 Thread tav

hi, i am running into a slight problem due to STILL not being able to
understand namespaces perfectly, and would appreciate if someone could help
out.

-
the situation is this:
-

i have a dtml document called "pageowners", on which i have a list property
called owners. which changes every hour. lets assume right now, it says tav
and Bill.

now, in the same folder, i have a dtml method called "parseit", and i have
three dtml documents, called "tav", "noa" and "Bill". there is a dtml
document corresponding to each owner.

each of the three documents have a title and content. parseit simply gives
them a table layout, which simplified immensely, looks like:

tabletrtd
dtml-var title
/tdtd
dtml-var owner-name
/td/tr/tablebr

what i want to do is display whomever is listed as an owner, in such nice
tables.

-
the problem is this:
-

in "standard_html_header", it looks up which owners are listed in
"pageowners", and then runs through them in a sequence. however, (and this
is where it gets tricky), i want the owners to be formatted by running them
thru "parseit".

however i get stuck when in parseit, as i dont know how to do dtml-var
Bill, i tried to set Bill in the namespace by using dtml-with
Billdtml-var parseit, and then tried to call dtml-var id within
"parseit" but that doesn't work :/

and, again, i want this to be done automatically, so i dont want to have to
manually list Bill, tav, noa, etc

i am pretty sure that DTML can handle this, and this is one of the reasons
why i like zope, because it lends itself to a structured system which is
easily maintainable, e.g. the owners could increase from 5 to a 1000, and
this would still work.

Any help would be much appreciated. Thanks in advance

--
best regards, tav


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )