[Zope] Advanced DTML Question

James W. Howe jwh@allencreek.com
Thu, 02 Mar 2000 11:31:15 -0500


At 04:01 PM 3/1/00 -0600, Evan Simpson wrote:
>----- Original Message -----
>From: James W. Howe <jwh@allencreek.com>
> > 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
>
>Quick, possibly misleading idea:  if you can give your Catalog entries a
>brain class with a function "anchorGroup" which returns the first letter of
>the entry, then you can use <dtml-if sequence-first-anchorGroup><a
>name="&dtml-anchorGroup;"></a></dtml-if>

I've tried to do something like you suggested, but it doesn't seem to 
work.  I'm probably not doing things quite correctly.  I've added a 
"getAnchorCharacter" method to my ZClass which correctly answers the 
character I want to use as an anchor.  I've tested this and know that it 
works.  I tried using "<dtml-if sequence-first-getAnchorCharacter> ...", 
but got no result.  Could you explain a bit more about how something like 
"sequence-first-xxx" works?  I haven't found any information on this form 
of a dtml-in variable.  Perhaps I'm just misunderstanding your solution.

In thinking about this solution, it seems that if I'm inside of a dtml-in 
iterating over entries in a Catalog, the objects known to the "dtml-in" 
aren't instances of my ZClass, but instances of some catalogging wrapper 
for my ZClass.  Therefore, it would seem that my getAnchorCharacter method 
wouldn't be accessible from within the dtml-in, but only from within a 
dtml-with which sets the object to be the object referenced by the catalog 
entry.

Can you clarify all this?

Thanks.

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