[Zope] Newbie: automatic template?

sean.upton@uniontrib.com sean.upton@uniontrib.com
Tue, 18 Feb 2003 16:33:28 -0800


For HTML documents, you could do a lot of this using the CMF (content
management framework) or Plone (a Zope CMS that uses the CMF).  I think this
might solve your concern, but you would need to familiarize yourself with
the CMF.  I would suggest starting with Plone (http://plone.org).

Use the CMF and create skin methods using ZPT and METAL macros.  METAL is a
macro-system in ZPT for the reuse of presentation elements.  You use the
built-in Document type in a CMFDefault or Plone CMS based on the CMF.  

Create a custom skin for a CMF site.

In a skin folder associated with that skin, create a ZPT called
masterNav.html, it will contain code that looks like this:

<html metal:define-macro="master">
<body>
<table>
 <tr><td colspan="2"><!-- Top NAV --></td></tr>
 <tr>
  <td><!-- Left NAV --></td>
  <td><!--Content well, where the document goes-->
   <span metal:define-slot="main">Document goes here</span>
  </td>
 </tr>
 <tr><td colspan="2"><!-- Top NAV --></td></tr>
</table>
</body>
</html>

Then, create a template in the skin called document_view:

<html metal:use-macro="here/masterNav.html/macros/master">
  <head>
    <title tal:content="template/title">The title</title>
  </head>
  <body metal:fill-slot="main">
   <span tal:replace="here/CookedBody">Document goes here</span>
  </body>
</html>

We use this, for example, for a system that uploads press-releases in an
HTML format into a Plone Folder via FTP.  The default view (equivalent of
index_html in CMF) is set up to use the document_view template that we set
up in our skin, which means the document is automatically wrapped in a
navigation.


Sean

-----Original Message-----
From: Bin Zhang [mailto:bzhang@hawaii.edu]
Sent: Tuesday, February 18, 2003 4:04 PM
To: zope@zope.org
Subject: [Zope] Newbie: automatic template?


I am new to Zope.  I  wonder if this is possible:

First create a folder and create a page template using either DTML or 
ZPT, something like this:

<standard header>
<standard navigation>
Page content
<standard footer>


2. page authors upload standard html files to the folder (via ftp or 
webdav).

3. When viewed from the browser, the template is automatically applied 
to all uploaded files.

If this is possible, how can it be done?  Thanks for any pointers.

Bin



_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )