Hey guys, I wanted to change the default method from index_html to index_dtml. I did the work-around by adding the top-level "<dtml-var index_dtml>" trick, but I was wondering where within the source could I permanently change this? Also, is there an easy way that I could make Zope add an index_dtml instead of index_html each time I go to add a folder that needs a public interface? I kinda looked at the source but I'm not real good with Python (yet), so it might have slipped me by. Thanks in advance, Eron
So here's the situation.. A client wants to automatically include a dtml method in all dtml documents inside any given folder. So, using standard_html_header, I should be able to create some code to include 'folderid'_html_header. Right? Is there something that I am missing here? For some reason the dtml-if check doesn't work at all. I need to have this check in place, just in case the object doesn't exist in some folders. <dtml-comment> Give us folderid_html_header </dtml-comment> <dtml-let customhead="PARENTS[0].id + '_html_header'"> <dtml-comment> Check for object </dtml-comment> <dtml-if customhead> <dtml-comment> Object exists, render object </dtml-comment> <dtml-var expr="_[customhead]"> <dtml-comment> End check </dtml-comment> </dtml-if> <dtml-comment> End namespace injection </dtml-comment> </dtml-let> Any ideas? Or am I going about it completely wrong? -- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
Maybe this question will clear this quesstion up for me... why wouldn't you put a "custom" standard_html_header method into each differing folder and just call that method in all your documents? Why have a 'folderid'_html_header? "M. Adam Kendall" wrote:
So here's the situation.. A client wants to automatically include a dtml method in all dtml documents inside any given folder. So, using standard_html_header, I should be able to create some code to include 'folderid'_html_header. Right? Is there something that I am missing here? For some reason the dtml-if check doesn't work at all. I need to have this check in place, just in case the object doesn't exist in some folders.
<dtml-comment> Give us folderid_html_header </dtml-comment> <dtml-let customhead="PARENTS[0].id + '_html_header'"> <dtml-comment> Check for object </dtml-comment> <dtml-if customhead> <dtml-comment> Object exists, render object </dtml-comment> <dtml-var expr="_[customhead]"> <dtml-comment> End check </dtml-comment> </dtml-if> <dtml-comment> End namespace injection </dtml-comment> </dtml-let>
Any ideas? Or am I going about it completely wrong?
-- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
_______________________________________________ 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 )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
Because the client still wants to include the standard_html_header from the root to give the whole site the same look/feel. But the client also doesn't want to have to hard code all his documents with the specific folder header, in case they want to move a document from one folder to another. Does that make things a little clearer? On 01-Feb-2000 Chris McDonough wrote:
Maybe this question will clear this quesstion up for me... why wouldn't you put a "custom" standard_html_header method into each differing folder and just call that method in all your documents? Why have a 'folderid'_html_header?
"M. Adam Kendall" wrote:
So here's the situation.. A client wants to automatically include a dtml method in all dtml documents inside any given folder. So, using standard_html_header, I should be able to create some code to include 'folderid'_html_header. Right? Is there something that I am missing here? For some reason the dtml-if check doesn't work at all. I need to have this check in place, just in case the object doesn't exist in some folders.
<dtml-comment> Give us folderid_html_header </dtml-comment> <dtml-let customhead="PARENTS[0].id + '_html_header'"> <dtml-comment> Check for object </dtml-comment> <dtml-if customhead> <dtml-comment> Object exists, render object </dtml-comment> <dtml-var expr="_[customhead]"> <dtml-comment> End check </dtml-comment> </dtml-if> <dtml-comment> End namespace injection </dtml-comment> </dtml-let>
Any ideas? Or am I going about it completely wrong?
-- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
_______________________________________________ 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 )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
_______________________________________________ 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 )
-- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
Yep, clearer, thanks... How about this... create in each folder you publish (including the root object), a method titled folder_specific_contents or something. Then in the root object's standard_html_header, call it. What'll happen is this: If the root standard_html_header is this: <html><head><title><dtml-var title_or_id></title></head> Formatting placeholder. <dtml-var folder_specific_contents> And there's a folder named "stuff", within which is a method titled "folder_specific_contents" which contains: <h1>Hi, I'm folder specific contents of the <dtml-var title_or_id> folder.</h1> And the index_html of the stuff folder contains: <h2>This is my body content</h2> Calling /stuff from your web browser should show: Formatting placeholder. Hi, I'm folder specific contents of the stuff folder. This is my body content. Would this do it for you? Note that you need to do nothing to the content documents in each folder, you just need to make sure there's a folder_specific_contents method defined in each folder. "M. Adam Kendall" wrote:
Because the client still wants to include the standard_html_header from the root to give the whole site the same look/feel. But the client also doesn't want to have to hard code all his documents with the specific folder header, in case they want to move a document from one folder to another. Does that make things a little clearer?
On 01-Feb-2000 Chris McDonough wrote:
Maybe this question will clear this quesstion up for me... why wouldn't you put a "custom" standard_html_header method into each differing folder and just call that method in all your documents? Why have a 'folderid'_html_header?
"M. Adam Kendall" wrote:
So here's the situation.. A client wants to automatically include a dtml method in all dtml documents inside any given folder. So, using standard_html_header, I should be able to create some code to include 'folderid'_html_header. Right? Is there something that I am missing here? For some reason the dtml-if check doesn't work at all. I need to have this check in place, just in case the object doesn't exist in some folders.
<dtml-comment> Give us folderid_html_header </dtml-comment> <dtml-let customhead="PARENTS[0].id + '_html_header'"> <dtml-comment> Check for object </dtml-comment> <dtml-if customhead> <dtml-comment> Object exists, render object </dtml-comment> <dtml-var expr="_[customhead]"> <dtml-comment> End check </dtml-comment> </dtml-if> <dtml-comment> End namespace injection </dtml-comment> </dtml-let>
Any ideas? Or am I going about it completely wrong?
-- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
_______________________________________________ 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 )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
_______________________________________________ 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 )
-- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
On Tue, 1 Feb 2000, M. Adam Kendall wrote:
Because the client still wants to include the standard_html_header from the root to give the whole site the same look/feel. But the client also doesn't want to have to hard code all his documents with the specific folder header, in case they want to move a document from one folder to another. Does that make things a little clearer?
Is there something that I am missing here? For some reason the dtml-if check doesn't work at all. I need to have this check in place, just in case the object doesn't exist in some folders.
<dtml-comment> Give us folderid_html_header </dtml-comment> <dtml-let customhead="PARENTS[0].id + '_html_header'"> <dtml-comment> Check for object </dtml-comment> <dtml-if customhead>
Here, customhead is a string that will always evaluate to true. Try: <dtml-if "_[customhead]">
Any ideas? Or am I going about it completely wrong?
A slightly more flexible way of doing it would be to use a standard_html_header DTML method in each folder that needs one that looks like this: <dtml-var "PARENTS[-1].standard_html_header"> <p>My custom stuff This will include the root standard_html_header file. It acts slightly differently, as adding one of these to a folder will also change the behaviour of all subfolders - might be better, or might not. -- ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen
To be thorough, you'd have to change it in a lot of places. It's a method of quite a few renderable object instance in your database, sort of akin to Python's __repr__ method of an object. If you just want to do this for your own purposes, I would suggest writing a Python class that subclasses the Zope Folder class (in OFS/Folder.py) and does "the right thing" when the index_dtml method is called on it. It would also need to have an appropriate constructor that automagically puts an index_dtml method inside the folder when it's instantiated. This would have a limitation in that the root object (the App object) would still call index_html to render itself, but all your custom folders would be able to do the right thing for you. Or, of course, you could just not. :-) Eron Lloyd wrote:
Hey guys, I wanted to change the default method from index_html to index_dtml. I did the work-around by adding the top-level "<dtml-var index_dtml>" trick, but I was wondering where within the source could I permanently change this? Also, is there an easy way that I could make Zope add an index_dtml instead of index_html each time I go to add a folder that needs a public interface? I kinda looked at the source but I'm not real good with Python (yet), so it might have slipped me by.
Thanks in advance,
Eron
_______________________________________________ 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 )
-- Chris McDonough Digital Creations, Inc. Zope - http://www.zope.org
participants (4)
-
Chris McDonough -
Eron Lloyd -
M. Adam Kendall -
Stuart 'Zen' Bishop