Reusing standard_html_header/footer
This is not a question, I think it's more a request for comment. Problem: I have the following structure of folders. The top folder has the global standard_html_header and acquisition has it, that it is usable in all the subfolders. / standard_html_header SubFolder1/ SubFolder2/ Now I have a small modification in my headers from SubFolder1 downwards. Well, there are many ways to cope with that problem, I want to do it that ways: I want to integrate the old standard_html_header into the new one I define in SubFolder1. Ok, that can look like this: <load old standard_html_header> <my addtional code> The problem I have to solve now, is to load the old standard_html_header. Solution: I will give you all my tries, just for fun :-)) :-( First try: <dtml-var standard_html_header> The easy way certainly doesn't work. It gives a nice error: "SystemError: infinite recursion in document template" And it shows you, that Zope really is quick. It does the infinite loop in less than 30 seconds :-))) :-( Second try: <dtml-var "PARENTS[1].standard_html_header"> Well, this gives me the right object, but it isn't rendered. As I reviewed the list archive, I found out, that this seems to be normal. Maybe somebody can explain why, if he/she has some sparetime. :-( Third try: <dtml-var "PARENTS[1].standard_html_header(_.None,_)"> Wow, it works! But, as the smiley implies, it has its disadvantages: Using it in SubFolder2 gives again an infinite recursion. Find out for yourselves, why ;-)) :-) Fourth try: <dtml-var "PARENTS[-1].standard_html_header(_.None,_)"> or: <dtml-var "FolderName.standard_html_header(_.None,_)"> if you want to use the method of a subfolder. That seems to be the right way. Any comments? After the second try (my first serious one ;-) I tried the following: <dtml-with "PARENTS[-1]"> <dtml-var standard_html_header> </dtml-with> but this has the disadvantage, that standard_html_header uses the namespace of PARENTS[-1] to display things like id or title. Maybe this should go into the FAQ? Happy zoping, Michael ======================================================================= Michael Gutmann M.A. | Universitaetsrechenzentrum | Heinrich-Heine-Universitaet Duesseldorf | Tel. : +49 211 81-11969 | e-mail: gutmann@uni-duesseldorf.de | This space is intentionally http://gutmann.rz.uni-duesseldorf.de/ | left blank. =======================================================================
On Thu, 6 Jul 2000, Michael Gutmann wrote:
:-( Second try: <dtml-var "PARENTS[1].standard_html_header"> Well, this gives me the right object, but it isn't rendered. As I reviewed the list archive, I found out, that this seems to be normal. Maybe somebody can explain why, if he/she has some sparetime.
I haven't tried this and I am FAR from being a Zope expert. But, did you try dtml-call? Shouldn't that work?
On Thu, 6 Jul 2000, Michael Gutmann wrote:
:-( Second try: <dtml-var "PARENTS[1].standard_html_header"> Well, this gives me the right object, but it isn't rendered. As I reviewed the list archive, I found out, that this seems to be normal. Maybe somebody can explain why, if he/she has some sparetime.
I haven't tried this and I am FAR from being a Zope expert. But, did you try dtml-call? Shouldn't that work?
Hm, as I understood - and watching the results after a try - a dtml-call has no output. Michael
Michael Gutmann wrote:
This is not a question, I think it's more a request for comment.
Problem: I have the following structure of folders. The top folder has the global standard_html_header and acquisition has it, that it is usable in all the subfolders.
/ standard_html_header SubFolder1/ SubFolder2/
Now I have a small modification in my headers from SubFolder1 downwards. Well, there are many ways to cope with that problem, I want to do it that ways: I want to integrate the old standard_html_header into the new one I define in SubFolder1. Ok, that can look like this:
Not quite sure I understand what you are trying to do but.... in your root standard_html_header: <dtml-if local_header> <dtml-var local_header> </dtml-if> And then put the additions in local_header. Might get you what you want. -- "Linux: the operating system with a CLUE... Command Line User Environment". seen in a posting on comp.software.testing
On Thu, 6 Jul 2000, Bill Anderson wrote:
Michael Gutmann wrote:
This is not a question, I think it's more a request for comment.
Problem: I have the following structure of folders. The top folder has the global standard_html_header and acquisition has it, that it is usable in all the subfolders.
/ standard_html_header SubFolder1/ SubFolder2/
Now I have a small modification in my headers from SubFolder1 downwards. Well, there are many ways to cope with that problem, I want to do it that ways: I want to integrate the old standard_html_header into the new one I define in SubFolder1. Ok, that can look like this:
Not quite sure I understand what you are trying to do but....
I believe he is trying to do (in Java, because it's easiest for me to express it, here): public class StandardHtmlHeader { public String render() { return "Hello, World." } } public class SubStandardHtmlHeader extends StandardHtmlHeader { public void render() { return super() + " Woohoo!" } } Well, okay, not exactly, since we're talking acquisition not inheritance. But, the idea is the same. He wants to display the previous standard_html_header, with some additional stuff added, in his SubFolder's standard_html_header. --Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff.hoffman@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
On Thu, 6 Jul 2000, Bill Anderson wrote:
Michael Gutmann wrote:
<...>
Not quite sure I understand what you are trying to do but....
<...>
Well, okay, not exactly, since we're talking acquisition not inheritance. But, the idea is the same. He wants to display the previous standard_html_header, with some additional stuff added, in his SubFolder's standard_html_header.
--Jeff
Right, at least you got my point. But I didn't get Bill's Mail, or else I would have tried to explain it to him. Did it come over the list?? A little confused, Michael -- Michael Gutmann M.A. gutmann@uni-duesseldorf.de Universitaetsrechenzentrum Heinrich-Heine-Universitaet Duesseldorf
participants (4)
-
Bill Anderson -
Jeff K. Hoffman -
Michael Gutmann -
Nils Jeppe