[Zope] Help needed for a s(i|a)mple site

Mike Pelletier mike@digicool.com
Fri, 12 Nov 1999 08:47:57 -0500


> Hi,
>
> I thought I could acquire the Zen by readings the docs, following the
> list
> and just doing it, but I'm afraid I have to ask for some guidance.
> Please
> bear with me. I'd be glad if I would get at least a few hints, thanks in
> advance.
>
>
> I'm trying to set up a simple (sample?) Zope site, and thought I should
> try
> and use ZClasses.

    What you're doing isn't normally done with ZClasses.  Chances are, you
can do what you'd like much easier by using DTML Methods in the root and
acquiring them in subfolders.  Since this isn't a production site, I'll
assume you're using ZClasses just as an exercise.

    There are a couple caveats when using ZClasses.  (If these have been
corrected when I wasn't looking, hopefully someone will correct me.)  A
ZClass cannot be the index_html of a Folder.  You can call it that, but it
won't work.  What you _could_ do is put an index_html document in your
SFolder class, which looks for an SPage called 'index_spage' or some such
thing and renders it.  That would also allow you to manage your headers and
footers and whatnot from outside your content SPages.  Do try to follow the
convention of using standard_html_header and _footer.  With this little
scheme, the index_html method you end up with in your ZPage would something
look like this--

<dtml-var standard_html_header>

<dtml-if "objectValues(['SFolder'])
 <!-- display navigation links -->
</dtml-if>

<dtml-if index_spage>
 <dtml-var index_spage>
<dtml-else>
 <dtml-in "objectValues(['SPage'])">
  <!-- display available pages -->
 </dtml-in>
</dtml-else>

<dtml-var standard_html_footer>

    As you can see, nothing is happening here that couldn't be done by
placing a similar index_html method in your root Zope folder and acquiring
it in subfolders.

HTH,
Mike.