- Posts: 130
COMMUNITY FORUM
How to set number of comments shown
- Steven Trooster
- Topic Author
- Offline
- Premium Member
Less
More
2 years 11 months ago #179750
by Steven Trooster
How to set number of comments shown was created by Steven Trooster
On my site I have set comments to articles. But it will show below an article only 3 comments, with a navigation beneath that. The problem is thet the navigation doesn't work. It has a link with parameter ?start=3 , which reloads the page without updating the comments list.
I've been searching through all the settings, but I can't find any option to increase the number of comments shown at once.
And I've been going though the php code, but couldn't find a solution that will fix the next page bug. I tried to change start in the url to limitstart, but then I get no comments at all in Safari and in other browsers nothing changes
This is the code I found in the model item.php
But I can't find where it's getting the $limit from.
.
I've been searching through all the settings, but I can't find any option to increase the number of comments shown at once.
And I've been going though the php code, but couldn't find a solution that will fix the next page bug. I tried to change start in the url to limitstart, but then I get no comments at all in Safari and in other browsers nothing changes
This is the code I found in the model item.php
But I can't find where it's getting the $limit from.
public function getItemComments($itemID, $limitstart, $limit, $published = true)
{
$params = K2HelperUtilities::getParams('com_k2');
$order = $params->get('commentsOrdering', 'DESC');
$ordering = ($order == 'DESC') ? 'DESC' : 'ASC';
$db = JFactory::getDbo();
$query = "SELECT * FROM #__k2_comments WHERE itemID=".(int)$itemID;
if ($published) {
$query .= " AND published=1 ";
}
$query .= " ORDER BY commentDate {$ordering}";
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
return $rows;
}
Please Log in or Create an account to join the conversation.
- Steven Trooster
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 130
2 years 11 months ago #179751
by Steven Trooster
Replied by Steven Trooster on topic How to set number of comments shown
Kunnena still seems to have the code bug
This is the code in plain text:
public function getItemComments($itemID, $limitstart, $limit, $published = true)
{
$params = K2HelperUtilities::getParams('com_k2');
$order = $params->get('commentsOrdering', 'DESC');
$ordering = ($order == 'DESC') ? 'DESC' : 'ASC';
$db = JFactory::getDbo();
$query = "SELECT * FROM #__k2_comments WHERE itemID=".(int)$itemID;
if ($published) {
$query .= " AND published=1 ";
}
$query .= " ORDER BY commentDate {$ordering}";
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
return $rows;
}
This is the code in plain text:
public function getItemComments($itemID, $limitstart, $limit, $published = true)
{
$params = K2HelperUtilities::getParams('com_k2');
$order = $params->get('commentsOrdering', 'DESC');
$ordering = ($order == 'DESC') ? 'DESC' : 'ASC';
$db = JFactory::getDbo();
$query = "SELECT * FROM #__k2_comments WHERE itemID=".(int)$itemID;
if ($published) {
$query .= " AND published=1 ";
}
$query .= " ORDER BY commentDate {$ordering}";
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
return $rows;
}
Please Log in or Create an account to join the conversation.
- Steven Trooster
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 130
2 years 11 months ago #179753
by Steven Trooster
Replied by Steven Trooster on topic How to set number of comments shown
I figured out that pagination not working had to do with caching. I use JCH to cache pages. Turning it off made the comments skip to the next page. But that's something you want to do, because then the whole idea of caching becomes useless, if you turn it off for most part of your site.
Still the question remains: how can I set the limit of comments shown? I would like to see more than 3 comments on one page.
Still the question remains: how can I set the limit of comments shown? I would like to see more than 3 comments on one page.
Please Log in or Create an account to join the conversation.