[Zope] Advanced DTML Question

Bill Anderson bill@libc.org
Wed, 01 Mar 2000 19:03:40 -0700


"James W. Howe" wrote:
> 
> 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?
> 


Have you tried the How-To: 
-- 
In flying I have learned that carelessness and overconfidence are 
usually far more dangerous than deliberately accepted risks. 
          -- Wilbur Wright in a letter to his father, September 1900