[Zope] Organizing Zope Content

James W. Howe jwh@allencreek.com
Fri, 14 Jan 2000 16:04:55 -0500


Following some advise from Maik and Michel concerning ways to organization 
my Zope content to support a news web site I think I'm evolving toward a 
solution that I like.  I would like to explain it here a little bit just to 
get feedback.

First, I've decided that I should create a least two ZClasses.  One ZClass 
will be used to contain information and have functionality pertaining to an 
article.  The other ZClass will be an object collector which will contain 
(among other things) instances of my Article ZClass.  This folder basically 
will hold anything which pertains to a particular "issue" of the news 
site.  The Issue ZClass will have functionality which will allow it to 
assist objects which are responsible for displaying news to the 
user.  Neither the Issue or Article will know about how the article is to 
ultimately be formatted (actually the article contains minimal HTML 
formatting, but these objects don't know whether they will be contained in 
tables, frames, etc.)

To create a new issue of the newsmagazine, a new instance of Issue is 
created in the root of the web site.  It might get a name like 20001001 to 
indicate this is the issue created on January 10, 2000.  Inside the folder 
would be one or more Articles (plus other stuff yet to be 
determined).  Each article might get a name like 1, 2, 3.  An article would 
contain information about the article, the body, title, authorname, 
publication date, etc.

Outside of the content hierarchy would be one or more objects (Folders, 
currently) which define the various "pages" of the newsmagazine.  Currently 
I have a "HomePage" which displays an abbreviated version of the "top 
story" along with ads and other bits of information.  I also have a 
"CurrentIssue" page which displays a list of all headlines available in the 
current issue.  Finally I have a "NewsPage" which defines the layout of the 
actual news pages.

To display a particular news story, a URL similar to the following is used:

http://foobar.news.com/SiteRoot/20001001/1/NewsPage

Via acquisition, the NewsPage folder would be able to get story information 
from both the Article object itself (1) and the Issue object 
(20001001).  To look at a different article, simply use a different article 
number.  To view a different issue, use a different issue name.

In coming up with this design I had to rethink about which objects should 
be acquiring from which other objects.  If finally occurred to me that the 
object which is responsible for rendering the final version of the page 
should acquire information and functionality from the article and issue 
that it was supposed to display.  I had been thinking the opposite way 
where I would want to tell the NewsPage for example to display a particular 
page.  In a traditional web site, the URL might have looked like this:

http://foobar.news.com/NewsPage?issue=20001001&article=1

I've been playing around with my new scheme for a little bit and so far I 
like it.  Of course I still have a lot more to learn about coding in DTML 
but I think I've got a structure which will support what I want to do.  Or 
so I hope.

Comments and feedback are welcome.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103