Hi, this is a hack to show page navigation buttons in comment lists.
It is easy going, and not really hard hack. Don't know what the guys at xoops.org used, but this one is not complicated.
However, it works with FLAT view only. Other view modes are intact.
Change include/comment_view.php:
Around line 75, add this:
$com_limit = isset($_GET['com_limit']) ? intval($_GET['com_limit']) : 10;
$com_start = isset($_GET['com_start']) ? intval($_GET['com_start']) : 0;
just before
$com_id = isset($_GET['com_id']) ? intval($_GET['com_id']) : 0;
$com_rootid = isset($_GET['com_rootid']) ? intval($_GET['com_rootid']) : 0;
(note: 10 is default number of comments to show in flat view. This should be configurable from admin page, but I'm lazy to
program it).
and then change
if ($com_mode == 'flat') {
$comments =& $comment_handler->getByItemId($xoopsModule->getVar('mid'), $com_itemid, $com_dborder);
to:
if ($com_mode == 'flat') {
$total = $comment_handler->getCountByItemId($xoopsModule->getVar('mid'), $com_itemid);
$comments =& $comment_handler->getByItemId($xoopsModule->getVar('mid'), $com_itemid, $com_dborder, null, $com_limit, $com_start);
and after last $xoopsTpl->assing(...) add following:
if(isset($total)) {
include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
$q = "";
foreach($_GET as $key => $val) {
if($key != 'com_start') {
$q .= '&'.urlencode($key).'='.urlencode($val);
}
}
$pagenav = new XoopsPageNav($total, $com_limit, $com_start, 'com_start', substr($q, 1));
$xoopsTpl->assign('commentpagenav_text', $pagenav->renderNav());
$xoopsTpl->assign('commentpagenav_img', $pagenav->renderImageNav());
}
And that is all you need to change in code.
Also, you have to modify system_comments_flat.html template
to add navigation buttons. Just add
<{$commentpagenav_img}>
At top, and to the bottom of that template.
Hope it works for you. It works for me at
http://www.srbovanje.com Final note:
It has some issues with showing correct page when invoked from list-of-recent-comments block. But I'm looking into that, and hopefully I'll find solution quickly.