[thelist] Zope tip amends

martin.p.burns at uk.pwcglobal.com martin.p.burns at uk.pwcglobal.com
Wed Feb 20 10:25:01 CST 2002


Memo from Martin P Burns of PricewaterhouseCoopers

-------------------- Start of message text --------------------

Of course, we all realised that the meta tag should have been
<meta name="keywords" content="<dtml-var page_keywords>">
not
<meta keywords="<dtml-var page_keywords>">

and that the [1] footnote should have been inside the tip, not after the
closing tag. Corrected version below.

Cheers
Martin

<tip type="value for money">
Don't spend money on books for software which is about to time
out unless you've also budgeted for extending the software's license.
</tip>



<tip type="SSI on steroids with Zope - correction" author
="martin at members.evolt.org">
With Zope, pages are normally[1] built with 2 SSI-like methods (yes, it's
an OO system - each 'page' is an object) like so:
~~~~~~~~~~~~~~~~~
<dtml-var standard_html_header>
main content
<dtml-var standard_html_footer>
~~~~~~~~~~~~~~~~~
(where standard_html_header is an included object)

So, it's a normal SSI, right, so standard_html_header is just static text?

Well it can be, but it's cleverer than that. If your calling object has
properties
(say "page_keywords", "title" etc), then you can insert those properties
into
the includes. So standard_html_header might start something like:
~~~~~~~~~~~~~~~~~
<html>
     <head>
          <meta name="keywords" content="<dtml-var page_keywords>" />
          <title>
               <dtml-var page_title>
          </title>
~~~~~~~~~~~~~~~~

The benefit of this is that you only need *one* standard header (although
you can modularise this if you like, say bringing in the dtd and your
standard
meta tags from separate objects) for every page in your site.

Stick the standard header into the root directory of your site, and every
page
will be able to find it (even in subdirs) because all the sub-directories
are
sub-objects of the root folder and inherit the standard_html_header method
-
the Zope app server effectively walks up the hierarchy from the current
object
until it finds the method in question.

This also means that you can have a subdirectory-specific header by
sticking
a standard_html_header method in that subdirectory, and it will only apply
to
objects in (and below) that dir.

Finally, there's a nice extension of this order of precedence, so that if
you call
<dtml-var foo> in an object, Zope will search the object's own properties
first
for a property named dtd before looking in the object's directory, before
looking in parent directories etc.

So you can have page-specific headers, headers which apply to everything
else in that directory, and general headers applying to the rest of the
site...
*all* of which will be able to insert object-specific values.

[1] assuming you're just using basic DTML, with no additional products like
CMF, PTK, ZWiki or anything

</tip>



--------------------- End of message text --------------------

This e-mail is sent by the above named in their
individual, non-business capacity and is not on
behalf of PricewaterhouseCoopers.

PricewaterhouseCoopers may monitor outgoing and incoming
e-mails and other telecommunications on its e-mail and
telecommunications systems.
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you received
this in error, please contact the sender and delete the material from any
computer.




More information about the thelist mailing list