Is there a better way to code this?
Hello, I'm still having trouble trying to get Zope to use/ignore header and footer code in the appropriate places. 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)"> My problem was that on the first sequence item returned, Zope would insert the footer code. On items 2 and 3, Zope would not display the footer code, and, again, at the end of the page, when I did want the footer code to appear, it wouldn't. I had no trouble with the header code. I assume it had no trouble with the header code because by calling it to display that document itself, Zope inserted the code and set the renderedheader to 1, causing it to be ignored elsewhere in the document, as it should. So. Is there a better way to do this? Or is the above meet and right and not worthy of shame? I want to write a How-To so other newbies don't have to go through what I did. thank you, Luke
+----[ Luke Tymowski ]--------------------------------------------- | Hello, | | I'm still having trouble trying to get Zope to use/ignore header and footer | code in the appropriate places. ...snip... | So. Is there a better way to do this? Or is the above meet and right and | not worthy of shame? I want to write a How-To so other newbies don't have | to go through what I did. You should set flags to say when it's safe to render the header/footer, or you should remove the header/footer calls from documents you want to embed. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
Hello Andrew,
You should set flags to say when it's safe to render the header/footer, or you should remove the header/footer calls from documents you want to embed.
Can't do the latter. I'm building a weblog. I need to have the user enter entries for each day. I need for each day to display properly on its own - which means each needs header and footer code. And I need the front page to be created on the fly, consisting of the three latest entries, but, of course, without the header and footer code appearing in the body of the document. It now works as it should, but I want to know if there is a more elegant way of doing what I want to do. No point pointing fellow newbies at something and then have one of the gurus suggest I could have done it much more simply and elegantly. Luke
+----[ Luke Tymowski ]--------------------------------------------- | Hello Andrew, | | >You should set flags to say when it's safe to render the header/footer, | >or you should remove the header/footer calls from documents you want to | >embed. | | Can't do the latter. | I'm building a weblog. I need to have the user enter entries for each day. | I need for each day to display properly on its own - which means each needs | header and footer code. No it doesn't. You need to seperate content, and structure. Each day can simply be <dtml-var standard_html_header> <dtml-var day_content> <dtml-var standard_html_footer> Where day_content is what you have now sans header and footer. I don't know your structure, but, this is how I would do it knowing that... | And I need the front page to be created on the fly, | consisting of the three latest entries, but, of course, without the header | and footer code appearing in the body of the document. Yep you can get the content... | It now works as it should, but I want to know if there is a more elegant | way of doing what I want to do. No point pointing fellow newbies at | something and then have one of the gurus suggest I could have done it much | more simply and elegantly. Yes there is, and then you don't need all that hackery in the header/footer. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
participants (2)
-
Andrew Kenneth Milton -
Luke Tymowski