Re: [Zope] Is there a better way to code this?
Luke Tymowski writes:
To have Zope ignore the footer code in one place but still display footer code on other pages, I've resorted to this: <dtml-with history> <dtml-with 2000> <dtml-in "objectValues(['DTML Document'])" size=3 sort=title reverse> <dtml-call "REQUEST.set('renderedfooter',1)"> <dtml-var sequence-item> <a href="/history/2000/<dtml-var id>" title="Permanent link to the entry for <dtml-var title>">PermaLink</a> <br> <br> </dtml-in> </dtml-with> </dtml-with> <dtml-call "REQUEST.set('renderedfooter',0)"> What about
<dtml-with "_.namespace(standard_html_header='', standard_html_footer='')"> ... your code without "REQUEST" mangling ... </dtml-with> This redefines "standard_html_header/footer" inside the "with". Should work for DTML methods/documents. Dieter
Hello Dieter,
What about
<dtml-with "_.namespace(standard_html_header='', standard_html_footer='')"> ... your code without "REQUEST" mangling ... </dtml-with>
This redefines "standard_html_header/footer" inside the "with". Should work for DTML methods/documents.
It didn't work. If I removed all my request mangling from the header and footer code, and from the index.html looping code, Zope generates an error: Zope Error Zope has encountered an error while publishing this resource. Error Type: AttributeError Error Value: __call__ If I leave my request mangling in the header and footer code, but do what you suggest above, it works, except that the footer code is inserted after the very first record retrieved, and once again at the end of the document where it should appear. I suppose if I don't want hacks, as Andrew suggested, I should do a proper job of separating formatting from data. Luke
participants (2)
-
Dieter Maurer -
Luke Tymowski