[Zope-dev] HiperDOM & xmlc

Lalo Martins lalo@hackandroll.org
Fri, 15 Sep 2000 21:33:07 -0300


On Fri, Sep 15, 2000 at 03:17:00PM -0400, Shane Hathaway wrote:
> lalo@hackandroll.org wrote:
> > The only thing I _don't_ feel good about this kind of template
> > is that, in practice, we will probably lose the benefits of
> > things like <dtml-var standard_html_header> - meaning, when you
> > want to change the header of your site, you'll have to edit all
> > your templates.
> 
> I agree this is a problem, and speaking from experience, changing all
> templates is not an acceptable compromise.  For www.zope.org that would
> mean including the standard template in nearly every page, everywhere,
> because the pages on www.zope.org are nearly all "templates"
> themselves.  We would lose one of the primary benefits of Zope.

But using external fragments ("includes") is not a natural idea
for web designers. One of the main points of this fuss is to
allow them to create the templates in something like Dreamweaver.

> Another unacceptable compromise is including a variant of
> standard_html_header and _footer on every page (as is done now).  One
> reason is because it is not possible to write
> standard_html_header/_footer using well-formed XML.  The header begins
> the "html" tag, while the footer ends it.  In fact, most sites these
> days put the beginning of a table in _header and the end of the table in
> _footer.  Objects containing non-well-formed XML aren't compatible with
> a DOM-based solution.

I hadn't thought of this.

Of course you can already use "includes" which are valid XML,
such as a single row or cell of a table (for example, the
navbar of a complex site).

> This has been one of the points of discussion here at DC.  The only
> reasonable solution we've come up with is automatically wrapping the
> results of the rendering in an acquired object with a fixed name such as
> standard_page_template.

I don't like fixed names :-) what if I don't want to wrap a
particular template?

One sollution that could possibly work:

HiperDOMDocument at /foo/bar/somepage:

<html hdom:wrapper="site_template"><head>
<title>This will be overridden by the wrapper template</title>
</head><body>
This will not appear in the document.
<div hdom:id="someVariableName">
This will appear in the document.
</div>
</body>
</html>



HiperDOMDocument at /site_template:

<html><head>
<title hdom:text="title">Document title goes here via
aquisition</title>
<link rel=stylesheet href="http://yoursite.com/site_css"
type="text/css"/>
</head>
<body bgcolor="white">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#6699cc" hdom:text="navbar">
  Here goes the site navbar, which can be replaced by a
  subsite-specific navbar thanks to aquisition</td>
<td hdom:text="someVariableName">
  Here goes the actual body of the template, acquired from the
  calling (wrapped) template via the hdom:id attribute</td>
</tr>
</table>
</body>
</html>



To add even more sugar, there could be a button in the
management interface of the "somepage" document to
automagically merge it with the (current) wrapper so that it
reads:

<html hdom:wrapper="site_template"><head>
<title hdom:text="title">Document title goes here via
aquisition</title>
<link rel=stylesheet href="http://yoursite.com/site_css"
type="text/css"/>
</head>
<body bgcolor="white">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#6699cc" hdom:text="navbar">
  Here goes the site navbar, which can be replaced by a
  subsite-specific navbar thanks to aquisition</td>
<td hdom:text="someVariableName" hdom:id="someVariableName">
This will appear in the document.
</td>
</tr>
</table>
</body>
</html>

This would make the Dreamweaver freaks happy, I think.


BTW, please don't call the solution "xHTML Template"; it's not
xHTML, it's generic XML - it can easily be used for RSS or WML
or MathML or NewsML for example.

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo           mailto:lalo@hackandroll.org
         pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)    ---     http://zope.gf.com.br/BroDar