Using standard_html_header to display banner
Hi, I've been checking out Zope by reading the Zope Book, and am stuck with something: I'm building an intranet to contain documents. Each document should have a banner to display the document's Title and a bitmap whose id is the document's title and ".png" appended. For instance, a document called "widget.html" will have a Title section called "Quick & Dirty Guide to Widgets", and the Image object displayed along the title in the banner should be widget.html.png . 1. Here's the standard_html_header DTML Method: <html> <head><title><dtml-var title></title></head> <body> <table border="0" width="100%"> <tr> <td width="70%"><h1><dtml-var title></h1></td> <td align="right"><img src="<dtml-var id>.png"></td> </tr> </table> 2. And here's the index_html DTML Method that includes code to display a list of sub-folders: <dtml-var standard_html_header> <table width=100% border=0> <dtml-in expr="objectValues('Folder')"> <tr> <td><a href="&dtml-absolute_url;"><dtml-var title_or_id></a></td> <td><dtml-var bobobase_modification_time fmt="aCommon"><td> </tr> </dtml-in> </table> <dtml-var standard_html_footer> Problem: - If I use a DTML Method object for a document, <dtml-var title> in the standard_html_header shows the container's Title (!) instead of the document's Title - If I use a DTML Document instead, <dtml-var title> does show the document's Title as expected, but the <dtml-in ...> code is not run. Do you know of any easy way to let writers include a banner by just including <dtml-var standard_html_header> ? Thx a bunch for any tip EvH.
Hi EvH, Use a DTML method, but use <dtml-var document_title> -steve On Sunday, April 28, 2002, at 06:03 PM, EvH wrote:
Hi,
I've been checking out Zope by reading the Zope Book, and am stuck with something: I'm building an intranet to contain documents. Each document should have a banner to display the document's Title and a bitmap whose id is the document's title and ".png" appended. For instance, a document called "widget.html" will have a Title section called "Quick & Dirty Guide to Widgets", and the Image object displayed along the title in the banner should be widget.html.png .
1. Here's the standard_html_header DTML Method:
<html> <head><title><dtml-var title></title></head>
<body> <table border="0" width="100%"> <tr> <td width="70%"><h1><dtml-var title></h1></td> <td align="right"><img src="<dtml-var id>.png"></td> </tr> </table>
2. And here's the index_html DTML Method that includes code to display a list of sub-folders:
<dtml-var standard_html_header>
<table width=100% border=0>
<dtml-in expr="objectValues('Folder')"> <tr> <td><a href="&dtml-absolute_url;"><dtml-var title_or_id></a></td> <td><dtml-var bobobase_modification_time fmt="aCommon"><td> </tr> </dtml-in>
</table>
<dtml-var standard_html_footer>
Problem: - If I use a DTML Method object for a document, <dtml-var title> in the standard_html_header shows the container's Title (!) instead of the document's Title - If I use a DTML Document instead, <dtml-var title> does show the document's Title as expected, but the <dtml-in ...> code is not run.
Do you know of any easy way to let writers include a banner by just including <dtml-var standard_html_header> ?
Thx a bunch for any tip EvH.
At 20:13 28/04/2002 -0500, Steve Spicklemire wrote:
Use a DTML method, but use <dtml-var document_title>
Thx much Steve, but as explained before, it doesn't work as planned. Try this if you want to see the problem: 1. Create a test/ folder 2. Inside this folder, create a DTML Method object with ID = standard_html_header with the following code: <html><head><title><dtml-var title></title></head> <body>document_title = <dtml-var document_title><P>title = <dtml-var title><P> 3. Still inside the folder, create a DTML Method object with ID = dtml_method.html with the following code: <dtml-var standard_html_header> 4. Still inside the folder, create a DTML Document object with ID = dtml_document.html with the following code: <dtml-var standard_html_header> 5. Aim your browser at http://localhost:8080/test/dtml_method.html and http://localhost:8080/test/dtml_document.html Result: With both objects, <dtml-var document_title> displays the Title section of the standard_html_header object ("Standard HTML Header", in my case), but dtml_method.html displays "title = This is a test folder", while dtml_document.html displays "title = This is a Document" Conclusion: - If the document itself is a DTML Method, <dtml-var title> displays the Title section of the _container_ where the document lives - If the document is a DTML Document, <dtml-var title> displays the Title section of the _document_ itself Therefore, the designer has to decide whether s/he wishes to display a document's properties dynamically through a common standard_html_header DTML Method object (use DTML Document) or embed some code (use DTML Method), but not both. Bummer, because in index_html, in addition to displaying a banner dynamically through standard_html_header, I'd like to have Zope display links to all the documents located in sub-folders so that I wouldn't have to update index_html when a user has added a document in a sub-folder... I'll keep reading the Zope book to see if those two goals can be achieved through other ways. Thx again Eddie.
Sorry.. I misunderstood your problem. In that case use a DTML Document, and use PARENTS[0] to get to the folder: e.g., sub-folders: <dtml-in "PARENTS[0].objectIds('Folder')"> <a href="<dtml-var sequence-item url_quote>">&dtml-sequence-item;</a><br> </dtml-in> -steve On Monday, April 29, 2002, at 05:00 AM, Frederic Faure wrote:
At 20:13 28/04/2002 -0500, Steve Spicklemire wrote:
Use a DTML method, but use <dtml-var document_title>
Thx much Steve, but as explained before, it doesn't work as planned. Try this if you want to see the problem: 1. Create a test/ folder 2. Inside this folder, create a DTML Method object with ID = standard_html_header with the following code: <html><head><title><dtml-var title></title></head> <body>document_title = <dtml-var document_title><P>title = <dtml-var title><P> 3. Still inside the folder, create a DTML Method object with ID = dtml_method.html with the following code: <dtml-var standard_html_header> 4. Still inside the folder, create a DTML Document object with ID = dtml_document.html with the following code: <dtml-var standard_html_header> 5. Aim your browser at http://localhost:8080/test/dtml_method.html and http://localhost:8080/test/dtml_document.html
Result: With both objects, <dtml-var document_title> displays the Title section of the standard_html_header object ("Standard HTML Header", in my case), but dtml_method.html displays "title = This is a test folder", while dtml_document.html displays "title = This is a Document"
Conclusion: - If the document itself is a DTML Method, <dtml-var title> displays the Title section of the _container_ where the document lives - If the document is a DTML Document, <dtml-var title> displays the Title section of the _document_ itself
Therefore, the designer has to decide whether s/he wishes to display a document's properties dynamically through a common standard_html_header DTML Method object (use DTML Document) or embed some code (use DTML Method), but not both. Bummer, because in index_html, in addition to displaying a banner dynamically through standard_html_header, I'd like to have Zope display links to all the documents located in sub-folders so that I wouldn't have to update index_html when a user has added a document in a sub-folder... I'll keep reading the Zope book to see if those two goals can be achieved through other ways.
Thx again Eddie.
_______________________________________________ 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 )
Or.. maybe you could just use <dtml-var document_title> in the standard_html_header? ;-) -steve On Monday, April 29, 2002, at 05:42 AM, Steve Spicklemire wrote:
Sorry.. I misunderstood your problem. In that case use a DTML Document, and use PARENTS[0] to get to the folder:
e.g.,
sub-folders: <dtml-in "PARENTS[0].objectIds('Folder')"> <a href="<dtml-var sequence-item url_quote>">&dtml-sequence- item;</a><br> </dtml-in>
-steve
On Monday, April 29, 2002, at 05:00 AM, Frederic Faure wrote:
At 20:13 28/04/2002 -0500, Steve Spicklemire wrote:
Use a DTML method, but use <dtml-var document_title>
Thx much Steve, but as explained before, it doesn't work as planned. Try this if you want to see the problem: 1. Create a test/ folder 2. Inside this folder, create a DTML Method object with ID = standard_html_header with the following code: <html><head><title><dtml-var title></title></head> <body>document_title = <dtml-var document_title><P>title = <dtml-var title><P> 3. Still inside the folder, create a DTML Method object with ID = dtml_method.html with the following code: <dtml-var standard_html_header> 4. Still inside the folder, create a DTML Document object with ID = dtml_document.html with the following code: <dtml-var standard_html_header> 5. Aim your browser at http://localhost:8080/test/dtml_method.html and http://localhost:8080/test/dtml_document.html
Result: With both objects, <dtml-var document_title> displays the Title section of the standard_html_header object ("Standard HTML Header", in my case), but dtml_method.html displays "title = This is a test folder", while dtml_document.html displays "title = This is a Document"
Conclusion: - If the document itself is a DTML Method, <dtml-var title> displays the Title section of the _container_ where the document lives - If the document is a DTML Document, <dtml-var title> displays the Title section of the _document_ itself
Therefore, the designer has to decide whether s/he wishes to display a document's properties dynamically through a common standard_html_header DTML Method object (use DTML Document) or embed some code (use DTML Method), but not both. Bummer, because in index_html, in addition to displaying a banner dynamically through standard_html_header, I'd like to have Zope display links to all the documents located in sub-folders so that I wouldn't have to update index_html when a user has added a document in a sub-folder... I'll keep reading the Zope book to see if those two goals can be achieved through other ways.
Thx again Eddie.
_______________________________________________ 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 )
From: "EvH" <edward_van_h@bigfoot.com>
Do you know of any easy way to let writers include a banner by just including <dtml-var standard_html_header> ?
Yes. Do it the other way around. Instead of including things from the documents, make a template, and include the content from it. Make a DTML Method or a ZPT called index_html and put it in the root. From that include the content (in dtml with a <dtml-var content>) and then put all the content into dtml-methods called "content". Put one method in each folder making each folder a document. This also makes it easier to create automatic navigation. Best Regards Lennart Regebro Torped Strategi och Kommunikation AB
participants (4)
-
EvH -
Frederic Faure -
Lennart Regebro -
Steve Spicklemire