[Zope] HTMLDocument & Dynamic Navigation

Jaroslav Lukesh lsh@wo.cz
Sun, 8 Sep 2002 06:09:49 +0200


Try to pull out HTML document and save your HTML files as DTML DOcument.
Header will be composed with header from standard_html_header. At least a=
t
Zope 2.5.1/Win32 (I does not try at fresh installation - I have removed
HTML Document too).

index_html for you:

<dtml-var standard_html_header>
<dtml-in expr=3D"objectValues('DTML Document')" sort=3Did>
	<dtml-var sequence-item>
</dtml-in>
<dtml-var standard_html_footer>


If you want to have different processing if it have name "index.htm",
"*.htm*" and other/no extensions, here is solution:

And as your main rendering method use index_html like that:

<dtml-if "_.hasattr(aq_explicit,'index.htm')">
	Only index.htm will be rendered
     <dtml-var index.htm>
<dtml-else>
	If folder does not have "index.htm" then all files will be rendered
	<dtml-var standard_html_header>
	<dtml-var sys_list-item>
	<dtml-var standard_html_footer>
</dtml-if>=20

sys_list-item:

<dtml-in expr=3D"objectValues('DTML Document')" sort=3Did>
Do not render hidden files
<dtml-if "hasProperty('hide')">
	<dtml-else>
	Render only "*.htm*" and files that have property "html"
	<dtml-if "hasProperty('html')">
	<dtml-elif expr=3D"_.string.find(_['id'],'.htm')>0">
		<dtml-var sequence-item>
	<dtml-else>
		Render files as structured text
		<h3><dtml-var navi_BANNER></h3>
		<dtml-var sequence-item fmt=3Dstructured-text><br>
	</dtml-if>
</dtml-if>
</dtml-in>


Regards JL.


----------
Odes=EDlatel: Michael Hicks <MHicks@ahmail.com>
I like HTMLDocument's feature of auto-wrapping standard headers and foote=
rs
around a document when viewed. But I notice that there seem to be some
acquisition problems with the header when it's auto-added to an
HTMLDocument. I'm using a simple python script to return all files and
folders in the current folder as links for my left hand nav, and this
script is referenced in the standard header making for a nice auto
navigation feature. Works fine when the header is used in a DTMLDocument,
but nothing is returned from that script when the header is auto-wrapped
around HTMLDocuments.

Has anyone seen this before?