[Zope] using OrderedFolder to navigate objects in a folder

Trevor Toenjes zope@toenjes.com
Tue, 18 Sep 2001 14:12:05 -0400


Has anyone used OrderedFolder to create Previous and Next links to navigate
between the ordered items (I need to do this with zClasses)?

I am attempting to read Python source files for the first time, and dont see
how to do it.  I just see the functions to
      - 'move_object' in the folder
          - 'get_object_position'

A BETTER WAY?
I am searching for a better way than,
-looping through the folder
  -indexing the objects
     -figuring which object is current
        -create links to the previous and next in the sequence

This seems so raw and not very OO, compared to much of the power I have
found in Zope and Python so far...

MY IMAGINATION!
I would simply like to do something like...
<a href="<dtml-var orderedObject[self, -1]>"> Previous </a>  <a
href="<dtml-var orderedObject[self, 1]>"> Next </a>

Or even better, make navigation objects. (like the arrow-buttons.)
So standard nav could look like...or whatever you want.
 <<First  <Previous  Next>  Last>>
<dtml-var orderedObject[0, 0]> = first
<dtml-var orderedObject[0, -1]> or [_.len, 0] = last

Am I in Fantasy Land??  ;)  Is there a "better way"?
Any suggestions would be appreciated.

-Trevor