[Zope-CMF] Using portal_types to create How-Tos

Kent Polk kent@goathill.org
2 Aug 2001 19:08:39 GMT


On 1 Aug 2001 23:55:00 -0500, Timothy Wilson wrote:
> Hi everyone,
> 
> I just finished reading "Taming the Wild Types Tool" and "Using 'Scriptable
> Type Information' type objects." Nice work Tres.
> 
> Wouldn't it seem to be a good idea to use the Types Tool to create a
> "How-To" type object based on "Document"? If I'm understanding things
> correctly, you could then have a Topic that would display links to all the
> How-Tos on cmf.zope.org in one convenient location.

I have built four generations of How-to products with Zope now.
So far, the most easy and effective has been to create a CMF
PortalFolder, with the name/title for your howto grouping and drop
in a CMFWiki FrontPage and build from there.

The CMFWiki 'Regulations', etc in Advanced, for handling Role
categories, etc. is very nice and an important addition to std
ZWiki pages.

For documents such as manual pages, etc. which don't render themselves
at all as a Wiki page, drop out of the wiki and create CMF Documents
in which to store the contents (lots of opportunities for products
which render different views here).

Then, in the root of the CMF (or zope root, if you have more than
one CMF), create a dmtl method - get_cmf_id :

<dtml-in "portal_catalog.searchResults(id=sid)" size=1>
<dtml-var "portal_catalog.getobject(data_record_id_)()">
</dtml-in>

Then in your wiki page (for Csh as an example), at the bottom in
your References area, include:

<H3>References</H3>

 - "Csh Primer":get_cmf_id?sid=csh_primer

This uses a catalog query to locate the first returned instance of
your document with id 'csh_primer'

In reality, the get_cmf_id method needs to be a lot smarter in
order to handle no ids and more than one id returned from the
Catalog query, but I'll let you work that one out and report back.

If CMF items ever obtain Wiki characteristics, it will be great,
but until then, I personally think this is one of the better and
easier answers. It would be interesting to investigate ways to use
Topics, etc to provide different views as we have discussed quite
a bit, but until some of those issues come to reality, this method
is fairly effective.

BTW, Thanks to whomever fixed portal_catalog to subclass getobject().

I really do appreciate it.