[Zope] index_html for root

Sin Hang Kin iekentsin@infoez.com.mo
Wed, 8 Mar 2000 13:36:34 +0800


The attached file is intended to replace the current architecture of header
body footer of current zope default index_html.

Together there will be some attributes which can be used to modify its
behaviors :

wap - when defined, set the content-type in RESPONSE accordingly according
to Ducan's WAP howto. and sent out the <wml></wml> tag.

xml - when defined, set the content-type to xml/plaintext and the xml header

frame - when defined, prevent sent out the body tag

Only one of the above can be set. I still got problem with acquisition: if
one of these is set in a higher lever, then all lowerlevel see it. Are there
any easy way to set them off?

doctype - when defined, should contain the correct doctype string: currently
the following doctype is available:

    html4.0
    htmlstrict4.0
    htmltransistional4.0
    htmlstrict4.01
    htmltransitional4.01
    htmlframe4.0
    htmlframe4.01
    xml1.0
    xhtml1.0

The following is defined inside the index_html:

dtml-head - the content of the <head></head> section
dtml-headers - the content of contructs before the main body: This should
not left any tag open.
dtml-footers - the closing contents of the main body. There should not
assume any opening tags.

index_htm - the main content. a frameset statement if frame is defined. If
the main content contains a table, then the main table is defined here, the
parts in the table can then be dtml-var. A index1 index2   .... or indexr1c1
index r1c2 .... naming convention is suggested.

I strongly suggest convert the current zope sites to adapt to this style
through much works shall be needed.

Further work would be in the dtm-head: Recently I will suggest to adapt the
W3C core styles : http://www.w3.org/StyleSheets/Core/Overview

All suggestion and comments are welcome.

The index_html is below:
----------------------------------------------------------------------------
------------------
<dtml-if wap>
  <dtml-if "HTTP_USER_AGENT[:7]!='Mozilla'">
    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
    <!-- content-type set in footer -->
    <wml>
      <dtml-var index_htm missing>
    </wml>
    <dtml-call "RESPONSE.setHeader('Content-Type', 'text/vnd.wap.wml')">
  <dtml-else>
    <?xml version="1.0"?>
    <!DOCTYPE HTML SYSTEM "html40-mobile.dtd">
    <html>
      <head>
        <dtml-var dtml-head missing>
      </head>
      <body>
        <dtml-var dtml-headers missing>
        <dtml-var index_htm missing>
        <dtml-var dtml-footers missing>
      </body>
      <dtml-call "RESPONSE.setHeader('Content-Type', 'text/plain')">
    </html>
  </dtml-if>
<dtml-elif xml>
  <dtml-call "RESPONSE.setHeader('Content-Type', 'text/xml')">
  <dtml-if doctype>
    <dtml-var doctype>
  <dtml-else>
    <?xml version="1.0" encoding="utf-8"?>
  </dtml-if>
  <dtml-var index_htm missing="<xmlstring>Document Not Found</xmlstring>">
<dtml-elif frame>
   <dtml-if doctype>
      <dtml-var doctype>
   <dtml-else>
      <!DOCTYPE HTML>
   </dtml-if>
   <dtml-var index_htm missing>
<dtml-else>
  <dtml-if doctype>
    <dtml-var doctype>
  <dtml-else>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  </dtml-if>
  <html>
    <head>
      <dtml-var dtml-head missing>
    </head>
    <body>
      <dtml-var dtml-headers missing>
      <dtml-var index_htm missing>
      <dtml-var dtml-footers missing>
    </body>
  </html>
</dtml-if>