What are you using for the listing?
Right now I am executing my own script: $modx->db->query() and $modx->db->getRow()
Cheers,
Shlomo Tommer
Go with sharkbait’s rec on this one ...
I used loopdbchunk to accomplish this sort of thing for a member listing. I modified the loopdbchunk snippet to be able to pass a URL parameter to the pagination routine specifying the listing range. I also modified the pagination routine to output first, last, next, previous (as I recall). Also, the loopdbchunk itself got some work done on it, as I wanted to be able to use it for either a MODx table or an external MySQL database. Finally, I created a wrapper snippet which parses the URL line, sets up an appropriate query and calls loopdbchunk. There are probably less kludgy ways of accomplishing the same thing, but it worked for me.
Matt
Thank you, sharkbait and mconsidine, for your guidance.
loopDbChunk is indeed a cool tool and I have started using it.
My main problem with the tool is the page numbers. If you want page numbers as part of the pagination controls, you are required to set a fix number of pages to be listed, with no consideration to the actual number of rows there are. Thus, it is possible to render links to 10 page numbers of 100 rows each when there are actually only 30 records. Any suggestions?
One more nice2have feature may be to define another built-in placeholder (like the ’lo_ord’ counter) that returns the count of records in the dataset.
Thanks again
Cheers,
Shlomo Tommer
you can add this line:
$output .= $this->footer;
$this->perPage=$numRows<30?0:$this->perPage;//<- add this line for your special task
if($this->perPage > 0)