RE: [Zope] Question about Page Templates & DTML Document
I'm not sure I understand the question. If you mean that you would like to embed the document as part of your ZPT template, do what I suggested below. If you want to link to it, you likely need some way of having your application/templates generate HTML hyperlinks to each of the documents you want to link to - in this case, a Catalog query may be what you are looking for: supposing that all your news items are cataloged, you could have a method (python script, likely) to query the catalog to return a list of the last 5 news item object, for example, and then create a dtml-method that looped over each of those objects to get the title and abolsute URL of each, printing out the appropriate HTML). Also, I don't think that DTML Documents have __call__ methods, like the DTML method objects do, which means that you have to code around that to get the text out of the document for use; I would take a look at the API reference in the online help. Sean -----Original Message----- From: Martin Koekenberg [mailto:zope@digital-adventures.nl] Sent: Thursday, January 02, 2003 1:19 PM To: sean.upton@uniontrib.com Subject: RE: [Zope] Question about Page Templates & DTML Document Hello Sean, Thanks for your reaction in The Zope list. I've one more question. The page from where I link to a news item is an HTML document or aDTM method. Do you have an example how link to a pagetemplate with an external DTML Document. greetings Martin Koekenberg -----Original Message----- From: sean.upton@uniontrib.com To: zope@digital-adventures.nl, zope@zope.org Date: Thu, 02 Jan 2003 12:55:49 -0800 Subject: RE: [Zope] Question about Page Templates & DTML Document
1. You can't use the URL as the way to include the DTML method rendering in your ZPT. You actuially need to call the method in the context of some namespace. You actually need to get to (traverse to and obtain) the method object and call it via tal:content or similar within the page template. Assuming the DTML method is in the same folder, here/MyMethodName is what you would use in TAL to obtain it and call it.
2. You can include content generated by a DTML method inside a page template like this:
<span tal:replace="structure here/myDTMLMethod">Contents Go Here</span>
The structure at the beginning of the statement above makes sure that the results are not HTML-escaped, because it is quite likely the DTML method is returnning stuff that is already HTML formatted, not plain text...
Sean
-----Original Message----- From: Martin Koekenberg [mailto:zope@digital-adventures.nl] Sent: Thursday, January 02, 2003 12:27 PM To: zope@zope.org Subject: [Zope] Question about Page Templates & DTML Document
Hello,
This will be a newbe question.
I've a number of DTML Documents (News items) And a Page Template (Layout News item)
How can I load a dtml document in a Page template by using the URL to specify the dtml Document...
www.domain.com/newstemplate?newsitem_01
Who can help me ?
Thanks !!!
Martin Koekenberg
_______________________________________________ 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 (1)
-
sean.upton@uniontrib.com