If you are writing the code for the snippet and the queries why not just do the pagination as well.
I use this to setup a pagination function to display all the items in Gallery.:
$numPhotos = $this->modx->getCount('galItem',array(
'active' => '1'
));
if($numPhotos > PHOTOS_PER_PAGE) {
// $page is from the query string
// The '1' switches the pagination code to the photo page
$pagination = $this->getPagination($page, $numPhotos, $uri, '1');
$offset = ($page * PHOTOS_PER_PAGE) - PHOTOS_PER_PAGE;
}
The $offset is used in the query:
$query->limit(PHOTOS_PER_PAGE,$offset);
The pagination code is used by both my Photo and Video page - so setting it up for multiple queries isn't a problem. It isn't fancy - but it works. ( I don't use the search feature with the photos - so $issearch defaults to '0'. )
private function getPagination($page, $numVideos, $uri, $isVideo = '0', $issearch = '0') {
if($isVideo == '0') {
$numPages = ceil(intval($numVideos)/VIDEOS_PER_PAGE);
} else {
$numPages = ceil(intval($numVideos)/PHOTOS_PER_PAGE);
}
$pagination = 'Page: ';
for($idx=1; $idx <= $numPages; $idx++) {
if($idx == $page) {
$pagination .= "<b>" . $idx ."</b> | ";
} else if($issearch != '0') {
$pagination .= "<a href='" . $uri . "?page=" .$idx .
"&search_field=" . $issearch . "'>" . $idx . "</a> | ";
} else {
$pagination .= "<a href='" . $uri . "?page=" .$idx . "'>" . $idx ."</a> ";
}
}
return "<p id='pagination'>" . $pagination . "</p>";
}