You are not logged in Log in Join
You are here: Home » Members » 4AM Productions (Evan Simpson) » DTMLWiki » DTMLAsRootNode » wikipage_view

Log in
Name

Password

 
 
FrontPage » EvolutionaryProposals »

DTMLAsRootNode

Problem:

99% of all pages start with <dtml-var standard_html_header> and end with <dtml-var standard_html_footer>. Couldn't a document start with <dtml> and end with </dtml>?

There is no explict need for this. You can achieve this by creating an XML Document which is rendered using the XMLWidgets render subsystem. Check out this [Zope]? pages for more details:

Both these products are under development so be warned :)
NonetoBe?

Besides going XML, it's not hard to place this index_html in your root folder:

<dtml-var standard_html_header> <dtml-var body_html> <dtml-var standard_html_footer>

And now thanks to the wonders of acquisition, you can use body_html in your folders instead of index_html, and you don't need to include any headers or footers anymore. Of course you can always go back to the previous situation if you use index_html somewhere explicitly. And of course another consequence is that each document tends to have its own folder.

Alternatively, you could create a ZClass? that automagically includes the header and the footer.

-- MartijnF

Sure, but this only addresses index_html, not the other documents, or (with a ZClass?) doesn't take into account that sometimes you don't want a header and a footer. The proposed syntax is also newbie-friendly.

-- MindLace

And and and!, says jeffrey-p-shell, many layouts are more complex than just a "header" and a "footer". standard_html_header/footer rub me a million times the wrong way. My own solution to this is the (still unreleased) dtml-component tag, which let DTML be sortof like formatted documents in that you named another DTML Method to render the contents. It just is really really painful to have a complex layout have to be split into two "files".

What I have done as a compromise is to create a somewhat more intelligent standard_html-header that checks properties to determine what it should do or look like. For instance, my header/footer usually insert a navigation bar at the top (My own original idea!™ 8^) and a legal disclaimer at the bottom along with the requisite HTML preamble stuff. But, if I don't want the nav bar/disclaimer for a given page, I put a boolean property called no_nav_bar in the DTML Document. The header/footer methods detect the property and omits the nav bar.

-- [Caseman]?

How about something like

standard_html_template:

  <html>
   <head>
    <title><dtml-var title_or_id></title>
   </head>
   <body><dtml-var body></body>
  </html>

some_random_page_html:

  <dtml-template standard_html_template>
   <dtml-part body><p>This is just Some Random Page.</p></dtml-part>
  </dtml-template>

Of course the terminology probably needs some work. --[zigg]?