[Zope] - Template Question

Paul Everitt Paul@digicool.com
Thu, 17 Dec 1998 11:00:58 -0500


Roy wrote:
> Anyone know how templates are established and inherited?

Templates objects can be created in a number of ways.

Programmers can add class attributes that read a .dtml file off disk and
create a template instance as a class attribute.  For instance, the
entire Zope management screen is written this way.
'main','manage_menu','manage_main','manage_addDocumentForm' etc are all
examples.

Content managers can use the web interface to create Zope Document
objects that are stored in the database.

As for inherited, the actual word is "acquired".  Inheritance follows a
"is-a" hierarchy.  Acquisition follows an "in-a" hierarchy.  For the
theoretical background on acquisition, check out:

  http://www.digicool.com/releases/ExtensionClass/Acquisition.html

In practice, this means things in parent folders for which you have
permission can be used by things lower down.  standard_html_header is an
example.  It is defined in the top folder and reused by child folders,
*unless* a standard_html_header is defined in between.

> standard_html_header and standard_html_footer seem to be 
> "defaulted" into
> each newly created index.html. Is there a way to set what 
> template data
> gets inserted into each newly created document? Can this be 
> set globally as
> well as locally (folder level)?

There are a couple of facilities for doing this that haven't been
documented well and/or finished.

The first is the Lever.  It allows you to package up a whole bunch of
objects and install them into the Control Panel as a new kind of thing
that can be added.  Thus, you might create a Folder with five Documents
in it, including a local_html_header.  The Documents might point to
local_html_header instead of standard_html_header.

Once it is installed into the Control Panel, average users see a new
option in the add list.

A deeper idea that we need to finish up is Zope Classes.  This is
similar to the Lever, in that you package up things and install them
into the Control Panel.  However, when new things are made, they retain
their connection to the Control Panel.  You could thus have central
control over local_html_header by going to the Control Panel and
managing its copy of the Document.

The final option, of course, is to hack the source :^)

--Paul

Paul Everitt       Digital Creations
paul@digicool.com  540.371.6909