[Zope] Advanced DTML Question

James W. Howe jwh@allencreek.com
Wed, 01 Mar 2000 16:09:19 -0500


I'm trying to write a DTMLMethod which will write out a list of data items 
found from a catalog, sorted in alphabetical order.  This is 
easy.  Basically I do something like this:

<dtml-in "Catalog(meta_type='foo')" sort=someAttribute>
     <dtml-with "Catalog.getobject(data_record_id_)">
         <dtml-var objvar1><dtml-var objvar2> ...
     </dtml-with>
</dtml-in>

I've got this working, no problem.  Now, since the list of these items 
might be somewhat long, I want to build a simple index at the top of the 
page and use page anchors to get to key points on the page. Basically I'm 
going to display the alphabet and when the user clicks on a letter, the 
page should scroll somewhere in the vicinity of an item which starts with 
that letter.  To that end, what I would like to do is have some code inside 
of my dtml-in loop which gets the first letter from the current entry, 
checks to see if an anchor for that letter has been written, if not, a new 
anchor tag is inserted into the stream.  My problem is I don't really know 
how to code this up.  It seems like maybe that at least some of this should 
be done at the Python level but I'm not quite sure how to split up the 
functionality.

Has anybody done anything similar who would be willing to give me some 
advice as to the best way to go about solving this problem?

Thanks.

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