Accessing properties of child objects
Hello, I just wanted to rander the contents of a TInyTable object as follows: <h2>Title</h2> Col1 - Col2 - Col3<br /> ... I just tried: <h2><dtml-with tinytable><dtml-if title><dtml-var title><dtml-else>No Title</dtml-if></dtml-with></h2> <dtml-in tinytable> <dtml-var Col1> - <dtml-var Col2> - <dtml-var Col3><br /> </dtml-in> But I seem to misunderstand some principles about aquisition of properties because the title is every time the title of the base dtml document the TinyTable is presented in. I tried to do some other things but never got the right solution :-(. Could anybody please enlighten me? Kind regards Andreas.
Tille, Andreas writes:
.... I just tried:
<h2><dtml-with tinytable><dtml-if title><dtml-var title><dtml-else>No Title</dtml-if></dtml-with></h2> <dtml-in tinytable> <dtml-var Col1> - <dtml-var Col2> - <dtml-var Col3><br /> </dtml-in>
But I seem to misunderstand some principles about aquisition of properties because the title is every time the title of the base dtml document the TinyTable is presented in. You may try '<dtml-with expr="tinytable">'. If you do not use "expr", then "tinytable" is rendered (i.e. called) and the result is probably a sequence which does not have a "title" attribute.
You may find more information about non-transparent name lookup in the "Name lookup" section of <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> But you probably know that already.... Dieter
participants (2)
-
Dieter Maurer -
Tille, Andreas