hi friends, I am trying to paginate the comments, below is my code
$limit = 3;
$start = ($input->pageNum-1) * $limit;
$selector = "template=gallery, sort=-created, start=$start, limit=$limit";
$comments = FieldtypeComments::findComments("comments", $selector);
print_r($comments);
echo $comments->render();
if($input->pageNum > 1) echo "<a href='./page" . ($input->pageNum-1) . "'>Back</a> ";
if(count($comments) > $limit) echo "<a href='./page" . ($input->pageNum+1) . "'>Next</a>";
this render the comments but there is no next page link showing.
print_r shows there are 8 comments
ProcessWire\CommentArray Object ( [count] => 3 [total] => 8 [start] => 0 [limit] => 3 [pager] => 1 to 3 of 8 [items] => Array ( [Comment:0] => 163 [Comment:1] => 162 [Comment:2] => 161 ) [extraData] => Array ( [selectors] => ProcessWire\Selectors Object ( [count] => 4 [items] => Array ( [SelectorEqual:0] => Array ( [field] => template [operator] => = [value] => gallery [string] => template=gallery ) [SelectorEqual:1] => Array ( [field] => sort [operator] => = [value] => -created [string] => sort=-created ) [SelectorEqual:2] => Array ( [field] => start [operator] => = [value] => 0 [string] => start=0 ) [SelectorEqual:3] => Array ( [field] => limit [operator] => = [value] => 3 [string] => limit=3 ) ) [string] => template=gallery, sort=-created, start=0, limit=3 ) ) )
please help
Thank you
NB : how to get the "featured" comments for a particular $page ? my earlier question