[Zope] How to implement a round through the whole web site

R. David Murray bitz@bitdance.com
Fri, 25 Aug 2000 22:55:30 -0400 (EDT)


On 25 Aug 2000, Christian Leutloff wrote:
> My problem is now how to store the intermediate results in
> variables. I'm able to define a variable (myseq), but I'm not able to change
> the value afterwards:
> 
> <-------- snip
> <dtml-call "REQUEST.set('myseq', 7L)">
> 
> <dtml-if "_.has_key('seq')"> 
> <dtml-call "myseq = seq">  <-- wrong!!!

You're going to kick yourself on this one <grin>:

<dtml-call "REQUEST.set('myseq', seq)">

> Are there better solutions?
> 
> Do you know of a predefined way to implement the round through the web
> site? 

Given your description, which I'm not sure I completely understand,
I'd suggest adding a Catalog to your site, and creating an index field
in the catalog that indexes your document sequence number.  Also
make a meta data property in the catalog for the index field.  To get
your complete list of documents, just call the catalog, and you'll
get back everything indexed.  (If you index more stuff than your
documents, just query the Catalog for meta_type DTMLDocument, or
query your index field for >0 and <maxval.)

<dtml-in Catalog sort=indexfield>
  do your processing
</dtml-in>

Take a look at the Catalog HowTo's to decide what stuff you want in
meta data fields and how to get the object given its Catalog pointer
if you decide you need to do that.

Hmm.  To do prev and next buttons you could find the right document
by doing a search on your index field for a value less then the
current id (prev), sort in reverse, and do size=1 on the dtml-in.
For next, do >id and normal sort order and again size=1.

--RDM