Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
1 + 1 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     
getCount($criteria); $com_start = sprintf("%d", ($count / $com_limit)) * $com_limit; } [/code] You have to put it just after [code] if ($com_mode == 'flat') { [/code] And by the way, you can grab already modified comment_view.php from here http://mravojed.mindnever.org/comment_view.php.gz (this is comment_view.php from 2.0.9.2). If you use this file, only thing you have to change is comment_flat.html template, and you are ready to rock! N-joy.[/quote]" />

Re: PATCH: paged view for comments in flat mode
by mravojed on 2005/1/29 0:48:23

Update:

This is the missing code to calculate correct com_start from given com_id:

le="color: #000000"><?php if(($com_id > 0) && ($com_start == 0) && ($com_limit > 1)) { $criteria = new CriteriaCompo(new Criteria('com_modid', intval($xoopsModule->getVar('mid')))); $criteria->add(new Criteria('com_itemid', intval($com_itemid))); $criteria->add(new Criteria('com_id', intval($com_id), $com_dborder == 'ASC' ? "<" : ">=")); $count = $comment_handler->getCount($criteria); $com_start = sprintf("%d", ($count / $com_limit)) * $com_limit; }


You have to put it just after
le="color: #000000"><?php if ($com_mode == 'flat') {



And by the way, you can grab already modified comment_view.php from here
http://mravojed.mindnever.org/comment_view.php.gz
(this is comment_view.php from 2.0.9.2).


If you use this file, only thing you have to change is comment_flat.html template, and you are ready to rock!

N-joy.
PATCH: paged view for comments in flat mode
by mravojed on 2005/1/28 23:31:41

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:

le="color: #000000"><?php $com_limit = isset($_GET['com_limit']) ? intval($_GET['com_limit']) : 10; $com_start = isset($_GET['com_start']) ? intval($_GET['com_start']) : 0;


just before

le="color: #000000"><?php $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

le="color: #000000"><?php if ($com_mode == 'flat') { $comments =& $comment_handler->getByItemId($xoopsModule->getVar('mid'), $com_itemid, $com_dborder);


to:

le="color: #000000"><?php 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:

le="color: #000000"><?php 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

le="color: #000000"><?php <{$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.

Who's Online

112 user(s) are online (52 user(s) are browsing Support Forums)


Members: 0


Guests: 112


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits