RE: [ZOPE] newbie question: getting title_or_id from calling document
Thanks for the swift reply Trevor, very much appreciated. I think I understand what you mean, but I'm unsure as to the solution. I've recreated the header and the index_html as DTML methods, both in the same folder, and know get the folder name as the title, as expected based on what you said in your email. I then created another header (public_header) and test (testing) DTML methods, and get the same results when I try to display the title/ID of the calling document in the public_header DTML method. I'm at a loss on how to proceed to solve my problem. Can anyone help? Thanks for your time, Simon. -----Original Message----- From: Trevor Toenjes [mailto:zope@toenjes.com] Sent: 15 October 2001 18:28 To: Simon Brogden; zope@zope.org Subject: RE: [ZOPE] newbie question: getting title_or_id from calling document
From one Newbie to another...
DTML-methods inherit the properties of the calling container. In many cases, this is the folder that is being rendered. So the index_html that is called from the folder, takes on the properties, title, id, etc, from that folder. This assumes that index_html is a method and not a Doc. It took me a couple weeks using Zope to realize that the default folder set-up that includes index_html as a document should seldom be used... <read...never> (Actually I suggest that this should be removed from the ZMI, because it trips up most newbies. Or at least give the option to create index_html as a method.) Most of the Zopistas have told me that DTML-Documents are bad. In general you will mostly want to use Methods for everything that is an object or part of a template. DTML-Documents are good for just content. <read...text.> And consider the emminent message from anyone saying "USE ZPT instead of DTML". ;) -Trevor
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Simon Brogden Sent: Monday, October 15, 2001 1:05 PM To: zope@zope.org Subject: [ZOPE] newbie question: getting title_or_id from calling document
Hello!
I'm trying to create a standard_header that when included in a document uses the calling documents namespace. So, if the standard_header was: <html> <head> <title><dtml-var title_or_id></title </head> ... ...
and the index_html document had as it's first line: <dtml-var standard_header>
How can I make the standard header DTML document write the title/ID of index_html or any of the documetns that call/include it?.
Apologies in advance if I'm being thick.
Cheers, Simon.
_______________________________________________ Zope maillist - Zope@zope.org 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 )
I then created another header (public_header) and test (testing) DTML methods, and get the same results when I try to display the title/ID of the calling document in the public_header DTML method.
If you want the title of the folder, then your calling-Document needs to be a method. If there is no reason that your DTML-Doc has to be a doc, this is your solution. DTML-docs are folderish and have their own properties that will be inherited by a method in the namepsace, overriding the folder properties. This is why I have been told dont use DTML-Docs. I am sure there is some DTML-magic workaround for your public_header that only calls the title of the objecttype('Folder'). But sometimes Zope work-arounds are a replacement for mis-used object types and architecture. -Trevor
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Simon Brogden Sent: Monday, October 15, 2001 1:47 PM To: zope@zope.org Subject: RE: [ZOPE] newbie question: getting title_or_id from calling document
Thanks for the swift reply Trevor, very much appreciated.
I think I understand what you mean, but I'm unsure as to the solution.
I've recreated the header and the index_html as DTML methods, both in the same folder, and know get the folder name as the title, as expected based on what you said in your email. I then created another header (public_header) and test (testing) DTML methods, and get the same results when I try to display the title/ID of the calling document in the public_header DTML method.
I'm at a loss on how to proceed to solve my problem.
Can anyone help?
Thanks for your time, Simon.
-----Original Message----- From: Trevor Toenjes [mailto:zope@toenjes.com] Sent: 15 October 2001 18:28 To: Simon Brogden; zope@zope.org Subject: RE: [ZOPE] newbie question: getting title_or_id from calling document
From one Newbie to another...
DTML-methods inherit the properties of the calling container. In many cases, this is the folder that is being rendered. So the index_html that is called from the folder, takes on the properties, title, id, etc, from that folder. This assumes that index_html is a method and not a Doc. It took me a couple weeks using Zope to realize that the default folder set-up that includes index_html as a document should seldom be used... <read...never> (Actually I suggest that this should be removed from the ZMI, because it trips up most newbies. Or at least give the option to create index_html as a method.) Most of the Zopistas have told me that DTML-Documents are bad. In general you will mostly want to use Methods for everything that is an object or part of a template. DTML-Documents are good for just content. <read...text.>
And consider the emminent message from anyone saying "USE ZPT instead of DTML". ;)
-Trevor
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Simon Brogden Sent: Monday, October 15, 2001 1:05 PM To: zope@zope.org Subject: [ZOPE] newbie question: getting title_or_id from calling document
Hello!
I'm trying to create a standard_header that when included in a document uses the calling documents namespace. So, if the standard_header was: <html> <head> <title><dtml-var title_or_id></title </head> ... ...
and the index_html document had as it's first line: <dtml-var standard_header>
How can I make the standard header DTML document write the title/ID of index_html or any of the documetns that call/include it?.
Apologies in advance if I'm being thick.
Cheers, Simon.
_______________________________________________ Zope maillist - Zope@zope.org 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 maillist - Zope@zope.org 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 )
participants (2)
-
Simon Brogden -
Trevor Toenjes