RE: [ZOPE] newbie question: getting title_or_id from calling document
I don't think I've expressed the problem clearly enough. It's not the folder title we need, it's the title/ID of the document/method that includes the header(via "dtml-var standard_header") . The site has pages with a lot of common content that can be split into the standard_header or standard_footer objects. The header has an HTML block: .... <head> <title><dtml-var title_or_id></title> </head> .... When the header is used by a page, I want the title to be that of the page that includes it, not the name of the header file. So, if index_html, with a title of "Homepage" has: <dtml-var standard_header> I want the resultant HTML to look like: .... <head> <title>Homepage</title> </head> .... Not "header" or the title of the standard_header file. I'm guessing that the same is going to apply to the footer, as it needs to display the modification time. I want to make the maintenance of the site easier by lumping together the common parts. If I can't get the above to work, I'm assuming that the only resort is to be long-winded (like my email) and forget about using headers & footers and hardcode these bits into every page. There's a lot of JavaScript too, which needs substitution for each page it's used on. So it's not just the HTML title block. Am I missing a technique/being thick? Tanks for your time, Simon. -----Original Message----- From: Trevor Toenjes [mailto:zope@toenjes.com] Sent: 15 October 2001 19:25 To: Simon Brogden; zope@zope.org Subject: RE: [ZOPE] newbie question: getting title_or_id from calling document
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 )
On Tue, Oct 16, 2001 at 12:53:15PM +0100, Simon Brogden wrote:
I don't think I've expressed the problem clearly enough. It's not the folder title we need, it's the title/ID of the document/method that includes the header(via "dtml-var standard_header") .
You can get the title of a DTML Document, but I think you cannot get the title of a DTML Method - Methods do not have attributes. Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
Oleg Broytmann wrote:
On Tue, Oct 16, 2001 at 12:53:15PM +0100, Simon Brogden wrote:
I don't think I've expressed the problem clearly enough. It's not the folder title we need, it's the title/ID of the document/method that includes the header(via "dtml-var standard_header") .
You can get the title of a DTML Document, but I think you cannot get the title of a DTML Method - Methods do not have attributes.
DTML Method titles are accessible as <dtml-var document_title>. Look at the default DTML in a DTML method, which (in zope 2.3.3) has a bunch of cool variables like this. -- Jim Washington
On Tue, Oct 16, 2001 at 08:18:21AM -0400, Jim Washington wrote:
DTML Method titles are accessible as <dtml-var document_title>.
This is one of the funniest things I have ever saw :-))) Method's title is called document_title! LOL! Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Tue, Oct 16, 2001 at 08:18:21AM -0400, Jim Washington wrote:
DTML Method titles are accessible as <dtml-var document_title>.
This is one of the funniest things I have ever saw :-))) Method's title is called document_title! LOL!
L-VL-OL! Hear! Hear! :D I guess this is one of the magical steps toward ZopeZen. ;) You have to experience and struggle through it in order to learn it. There is no way to get this out of any documentation. RANT! This is an example of Zope quirkiness that makes it unfriendly to new users. But the Zope steering group do not seem interested making usability and consistency improvements. That would be boring and too commercial. This is not important enough technically. Hopefully the new open group will consider this to make Zope more accessible in the future.
On Tue, Oct 16, 2001 at 09:34:42AM -0400, Trevor Toenjes wrote:
On Tue, Oct 16, 2001 at 08:18:21AM -0400, Jim Washington wrote:
DTML Method titles are accessible as <dtml-var document_title>.
This is one of the funniest things I have ever saw :-))) Method's title is called document_title! LOL!
L-VL-OL! Hear! Hear! :D I guess this is one of the magical steps toward ZopeZen. ;) You have to experience and struggle through it in order to learn it.
No, I have not. In any case Documents and Methods are not suitable to display content (only to manipulate one). I am going to try Kaivo DocumentLibrary. Oleg. -- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
+-------[ Trevor Toenjes ]---------------------- | | RANT! | This is an example of Zope quirkiness that makes it unfriendly to new users. | But the Zope steering group do not seem interested making usability and | consistency improvements. That would be boring and too commercial. This is | not important enough technically. | Hopefully the new open group will consider this to make Zope more accessible | in the future. I think you miss the point, if anyone could do it, Zope Corporation's consulting would dry up over night d8) It's a PLOT I say! </conspiracy_theory> SOYLENT GREEN IS PEOPLE! d8) -- Totally Holistic Enterprises Internet| | Andrew Milton The Internet (Aust) Pty Ltd | | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
I don't think I've expressed the problem clearly enough. It's not the folder title we need, it's the title/ID of the document/method that includes the header(via "dtml-var standard_header") .
As I stated previously...
DTML-docs are folderish and have their own properties that will be inherited by a method in the namespace
standard_header (a DTML_METHOD) will render the title the calling myDTML_Document. Keep it clean, and only call methods or scripts from a DTML_Doc. A DTML_Document (called by another DTML_Doc) that includes <dtml-var title> will render its own title, not the title of its calling DTML_Doc. This means you can use Docs instead of folders to get a title. try it. My first Zope project, had me converting "most" of my DTML_Docs to DTML_Methods once I understood these rules. NOTE: You can get the ID of the method using the obscure <dtml-var document_id>. If you still need the title of the method, then it should be a DTML_Doc. -Trevor
participants (5)
-
Andrew Kenneth Milton -
Jim Washington -
Oleg Broytmann -
Simon Brogden -
Trevor Toenjes