index_html, method or doc?
hi all, can somebody tell me what makes more sense: using dtml-methods or dtml-docs for the index_htmls? cheers, jan -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- GMX Tipp: Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1! http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
Jan Sew wrote:
hi all,
can somebody tell me what makes more sense: using dtml-methods or dtml-docs for the index_htmls?
cheers,
jan
Hi Jan You have to use DTML methods for the index_html (usually you will want to include some other methods like standard_html-header and standard_html_footer in your index_html). Did you have a look into the Zope Book ? http://www.zope.org/Members/michel/ZB/ --- Flynt
You have to use DTML methods for the index_html (usually you will want to include some other methods like standard_html-header and standard_html_footer in your index_html). Did you have a look into the Zope Book ?
That's not quite correct. Both DTML Methods and DTML Documents work fine, but different: As a DTMLMethod, index_html will try to "acquire" all the parts it needs locally, e.g. you have a folder structure like this: ROOT |--- index_html |--- standard_html_header (with white background) |--- standard_html_footer |--- GREEN | --- standard_html_header (with green background) --- RED --- standard_html_header (with red background) RED/index_html will have a red background and GREEN/index_html will have a green one. Same with title attributes etc. If you use a DTML Document, it will only look for the "local" stuff, i.e. it will take its own title if you say "<dtml-var title>", and it will take the standard_html_header from the ROOT, which is white in the example. The other difference is that DTML Methods does not have properties at all. It can just acquire them. In most cases, people would use DTML Methods for almost everything. Only if you import HTML documents from the outside, it might be better to use DTML Documents. Cheers Joachim
Joachim Werner wrote:
You have to use DTML methods for the index_html (usually you will want to include some other methods like standard_html-header and standard_html_footer in your index_html). Did you have a look into the Zope Book ?
That's not quite correct. Both DTML Methods and DTML Documents work fine, but different:
As a DTMLMethod, index_html will try to "acquire" all the parts it needs locally, e.g.
you have a folder structure like this:
ROOT |--- index_html |--- standard_html_header (with white background) |--- standard_html_footer |--- GREEN | --- standard_html_header (with green background) --- RED --- standard_html_header (with red background)
RED/index_html will have a red background and GREEN/index_html will have a green one. Same with title attributes etc.
If you use a DTML Document, it will only look for the "local" stuff, i.e. it will take its own title if you say "<dtml-var title>", and it will take the standard_html_header from the ROOT, which is white in the example.
The other difference is that DTML Methods does not have properties at all. It can just acquire them. In most cases, people would use DTML Methods for almost everything. Only if you import HTML documents from the outside, it might be better to use DTML Documents.
Cheers
Joachim
Thank's for the clarification, I was a bit sloppy in my answer. --- Flynt
gents, i have to disagree with the two previous posts on this thread: i can see no reason why one _should_ use methods instead of docs for index_html unless one has a particular requirement: in other words, i would recommend docs for content (index_html usually hold content, no?) unless you have a good reason for using methods. this is also more consistent with the zope documentation (NB AFAIK the Zope Book does not seem to recommend methods over docs for content, but please correct me if i'm wrong on this) [http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.7.html] (yes, i know it's old ;-): "DTML Documents are used to hold content. If you want to store a large document, or lots of text, or a body of information, use a DTML Document. DTML Methods are used to carry out actions. If you want to render another object (like a DTML Document), execute a DTML script, or generate lots of dynamic content, use a DTML Method. Also, you may notice that the DTML Document management interface has a Properties view and the DTML Method management interface does not. This is because DTML Documents can have properties like all other Zope objects. DTML Methods share the properties of the folder than contains them." note that having content in docs facilitates clean indexing among other things... cheers, Garry On 27 Jun 2001, at 14:24, Joachim Werner wrote: From: "Joachim Werner" <joe@iuveno-net.de> To: "Flynt" <rhess@bic.ch>, "Jan Sew" <esolutions@gmx.net> Copies to: <zope@zope.org> Subject: Re: [Zope] index_html, method or doc? Organization: iuveno AG Date sent: Wed, 27 Jun 2001 14:24:47 +0200
You have to use DTML methods for the index_html (usually you will want to include some other methods like standard_html-header and standard_html_footer in your index_html). Did you have a look into the Zope Book ?
That's not quite correct. Both DTML Methods and DTML Documents work fine, but different:
As a DTMLMethod, index_html will try to "acquire" all the parts it needs locally, e.g.
you have a folder structure like this:
ROOT |--- index_html |--- standard_html_header (with white background) |--- standard_html_footer |--- GREEN | --- standard_html_header (with green background) --- RED --- standard_html_header (with red background)
RED/index_html will have a red background and GREEN/index_html will have a green one. Same with title attributes etc.
If you use a DTML Document, it will only look for the "local" stuff, i.e. it will take its own title if you say "<dtml-var title>", and it will take the standard_html_header from the ROOT, which is white in the example.
The other difference is that DTML Methods does not have properties at all. It can just acquire them. In most cases, people would use DTML Methods for almost everything. Only if you import HTML documents from the outside, it might be better to use DTML Documents.
Cheers
Joachim
_______________________________________________ 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 )
+-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/ "The Good Man has no shape." +-------------------------------------------+
Garry Steedman wrote:
gents,
i have to disagree with the two previous posts on this thread: i can see no reason why one _should_ use methods instead of docs for index_html unless one has a particular requirement: in other words, i would recommend docs for content (index_html usually hold content, no?) unless you have a good reason for using methods. this is also more consistent with the zope documentation (NB AFAIK the Zope Book does not seem to recommend methods over docs for content, but please correct me if i'm wrong on this)
[http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.7.html] (yes, i know it's old ;-):
"DTML Documents are used to hold content. If you want to store a large document, or lots of text, or a body of information, use a DTML Document.
DTML Methods are used to carry out actions. If you want to render another object (like a DTML Document), execute a DTML script, or generate lots of dynamic content, use a DTML Method.
Also, you may notice that the DTML Document management interface has a Properties view and the DTML Method management interface does not. This is because DTML Documents can have properties like all other Zope objects. DTML Methods share the properties of the folder than contains them."
note that having content in docs facilitates clean indexing among other things...
cheers,
Garry
Here are the simple rules I would use: If the index_html is only going to be accessed/called by it's direct URL and not acquired from some other folder then use a DTML Document; otherwise use a method. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Casey Duncan wrote:
Garry Steedman wrote:
gents,
i have to disagree with the two previous posts on this thread: i can see no reason why one _should_ use methods instead of docs for index_html unless one has a particular requirement: in other words, i would recommend docs for content (index_html usually hold content, no?) unless you have a good reason for using methods. this is also more consistent with the zope documentation (NB AFAIK the Zope Book does not seem to recommend methods over docs for content, but please correct me if i'm wrong on this)
[http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.7.html] (yes, i know it's old ;-):
"DTML Documents are used to hold content. If you want to store a large document, or lots of text, or a body of information, use a DTML Document.
DTML Methods are used to carry out actions. If you want to render another object (like a DTML Document), execute a DTML script, or generate lots of dynamic content, use a DTML Method.
Also, you may notice that the DTML Document management interface has a Properties view and the DTML Method management interface does not. This is because DTML Documents can have properties like all other Zope objects. DTML Methods share the properties of the folder than contains them."
note that having content in docs facilitates clean indexing among other things...
cheers,
Garry
Here are the simple rules I would use:
If the index_html is only going to be accessed/called by it's direct URL and not acquired from some other folder then use a DTML Document; otherwise use a method.
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
I like these simple rules. Because I usually make use of the acquisition mechanism, I use DTML methods for the index_html. And Joachims contribution explains very well the background. I know the principle *docs for content* (Garry, yes, this is emphasized also in the Zope book), but I remember very well, that when I was starting to play around with Zope I chose a document for the index_html right for this reason (thinking that it is content) and promptly got caught (I followed the examples in the Zope book and it was _not_ working until I realized, I had to use a method for the index_html). --- Flynt
I think that the previous posts on this subject have mixed up two different thoughts, and I would like to clearly separate them. 1) Should index_html BE a DHTML document or should it be a DHTM method? 2) Should index_html USE DHTML methods? On number 1) it needs to be a document, not a method. It will be requested from a browser and needs to have its own context, including the REQUEST and so on, so it needs to be a document. On number 2), index_html may very well use DHTM methods as a convenience to avoid cramming all the code into one page, which would also prevent any reuse of that code. Jan Sew, does this answer your question? Cheers, Tom P
Hi all, the common mistake which seems to manifest with this discussion is to assume, zope is by any means a classic webserver. It is not. So index_html is merely like pythons __str__() method on objects. Usually, __str__() does not represent content by itself, its a view to the content of the object. Putting content pages together does not mean to use zope. Using zope one would plan a hierarchical display of content. Unfortunately zopes installation does a bad example of using zope in respect of content representation. Every page is cluthered with <dtml-var standard_html_header> and footer. Using zope the right way would eihter include building (Z-)Classes for document types which render their unique content or at least using acquired index_html methods on folder objects. The folder object then becomes the smallest publicable content element. (reachable via URL) (URLs containing index_html are considered bad style ;) The more or less static content can then go to an object like "content" or "de", "en" or such. (Which can be a DTML Document). Properties are the properties of the folder object. It should only contain the difference to all other pages where index_html calls some methods to render navigation elements and more. So index_html schould really be a method. If the content is really large, it will probably never be read ;) If its meant to be downloadet, there are file objects... Regards Tino --On Mittwoch, 27. Juni 2001 16:46 +0000 Garry Steedman <gs@styrax.com> wrote:
gents,
i have to disagree with the two previous posts on this thread: i can see no reason why one _should_ use methods instead of docs for index_html unless one has a particular requirement: in other words, i would recommend docs for content (index_html usually hold content, no?) unless you have a good reason for using methods. this is also more consistent with the zope documentation (NB AFAIK the Zope Book does not seem to recommend methods over docs for content, but please correct me if i'm wrong on this)
[http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.7.html] (yes, i know it's old ;-):
"DTML Documents are used to hold content. If you want to store a large document, or lots of text, or a body of information, use a DTML Document.
DTML Methods are used to carry out actions. If you want to render another object (like a DTML Document), execute a DTML script, or generate lots of dynamic content, use a DTML Method.
Also, you may notice that the DTML Document management interface has a Properties view and the DTML Method management interface does not. This is because DTML Documents can have properties like all other Zope objects. DTML Methods share the properties of the folder than contains them."
note that having content in docs facilitates clean indexing among other things...
cheers,
Garry
On 27 Jun 2001, at 14:24, Joachim Werner wrote:
From: "Joachim Werner" <joe@iuveno-net.de> To: "Flynt" <rhess@bic.ch>, "Jan Sew" <esolutions@gmx.net> Copies to: <zope@zope.org> Subject: Re: [Zope] index_html, method or doc? Organization: iuveno AG Date sent: Wed, 27 Jun 2001 14:24:47 +0200
You have to use DTML methods for the index_html (usually you will want to include some other methods like standard_html-header and standard_html_footer in your index_html). Did you have a look into the Zope Book ?
That's not quite correct. Both DTML Methods and DTML Documents work fine, but different:
As a DTMLMethod, index_html will try to "acquire" all the parts it needs locally, e.g.
you have a folder structure like this:
ROOT | --- index_html | --- standard_html_header (with white background) | --- standard_html_footer | --- GREEN | --- standard_html_header (with green background) --- RED --- standard_html_header (with red background)
RED/index_html will have a red background and GREEN/index_html will have a green one. Same with title attributes etc.
If you use a DTML Document, it will only look for the "local" stuff, i.e. it will take its own title if you say "<dtml-var title>", and it will take the standard_html_header from the ROOT, which is white in the example.
The other difference is that DTML Methods does not have properties at all. It can just acquire them. In most cases, people would use DTML Methods for almost everything. Only if you import HTML documents from the outside, it might be better to use DTML Documents.
Cheers
Joachim
_______________________________________________ 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 )
+-------------------------------------------+ Garry Steedman mailto:gs@styrax.com Styrax Associates http://www.styrax.com/
"The Good Man has no shape." +-------------------------------------------+
_______________________________________________ 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 (7)
-
Casey Duncan -
Flynt -
Garry Steedman -
Jan Sew -
Joachim Werner -
Thomas B. Passin -
Tino Wildenhain