Cover' . "\n";
$data[0] = '
 | ';
$td = 1; // this iterator-tracker will count how many thumbs we have in a row
$i = 1; // this will server as our index ref point for the $data[] array, which will hold our main content (started above)
// query to get the categories
$catalog_cats = "SELECT id, name FROM $category_table ORDER BY sort";
$result_cats = $db->query($catalog_cats);
if (DB::isError($result_cats)) {
echo $result->getDebugInfo();
}
// parse the data
while (list($cat_id, $cat_name) = $result_cats->fetchRow()) {
$menu .= ''.$cat_name.'' . "\n";
$catalog_sql = "SELECT name, start, end, thumb, pdf FROM $catalog_table WHERE catalog_cat_id=$cat_id ORDER BY start";
$result = $db->query($catalog_sql);
if (DB::isError($result)) {
echo $result->getDebugInfo();
}
while (list($name, $start, $end, $thumb, $pdf) = $result->fetchRow()) {
$plural = '';
if ($end != $start && $end != 0) { $pages = $start . '-' . $end; $plural="s"; }
else { $pages = $start; }
if ($td==1) { $data[$i] .= "\n"; }
$data[$i] .= ' '.$name.' Page'.$plural.': '.$pages.' | ' . "\n";
if ($td==$rows) { $data[$i] .= "
\n"; $td = 0; }
++$td;
}
// clean up if we're left with an incomplete row
$td = ($td-1);
if ($td-1 < $rows) {
while ($td != $rows) {
$data[$i] .= ' | '."\n";
++$td;
}
}
$data[$i] .= "\n";
++$i;
$td = 1;
}
$pager_params = array(
'mode' => 'Sliding',
'append' => false, //don't append the GET parameters to the url
'path' => '',
'fileName' => 'javascript:HTML_AJAX.replace(\'target\',\'master-ajax.php?pageID=%d\');', //Pager replaces "%d" with the page number (a digit)
'perPage' => 1, //show x items per page
'delta' => 3, //Number of page numbers to display before and after the current one.
'itemData' => $data,
);
$pager = & Pager::factory($pager_params);
$n_pages = $pager->numPages();
$current = $pager->getCurrentPageID();
$links = $pager->getLinks();
echo '
| ';
$pattern = '\/\*catid'.$current.'\*\/';
$replace = 'font-weight: bold;';
$menu = eregi_replace($pattern,$replace,$menu);
echo $menu;
echo ' |
';
foreach ($pager->getPageData() as $item) {
echo $item;
}
?>