Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: Comments counts in Article Categorys
Pages: [1]   Go Down
  Print  
Author Topic: Comments counts in Article Categorys  (Read 3298 times)
0 Members and 1 Guest are viewing this topic.
Outbreaker
Full Member
***

Karma: 3
Offline Offline

Posts: 55


Email
« on: December 06, 2010, 20:00:53 »

HI Smiley

What about a plugin that shows the comments counts afte the Hits count in the Article Categorys?
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #1 on: December 07, 2010, 15:36:54 »

I have never heard about such plugin. And I don't know how it could be implemented (because category pages aren't support any plugin's calls).
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Outbreaker
Full Member
***

Karma: 3
Offline Offline

Posts: 55


Email
« Reply #2 on: December 08, 2010, 00:08:21 »

What about a manual modification? I did this to included the Ratings can this also be done for JComments?

components/com_content/views/category/tmpl/default_items.php

Under this line:
Code:
<?php echo JHTML::_('grid.sort',  'Hits''a.hits'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
I added this:
Code:
<td align="center" class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="5%" nowrap="nowrap">
<?php echo JHTML::_('grid.sort',  'Rating''rating'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>

And under this line:
Code:
<?php echo $this->escape($item->hits) ? $this->escape($item->hits) : '-'?>
</td>
I added this:
Code:
<td align="center">
<?php echo $this->escape($item->rating) ? $this->escape($item->rating) : '-'?>
</td>
« Last Edit: December 08, 2010, 00:11:58 by Outbreaker » Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #3 on: December 08, 2010, 02:34:10 »

Yes, you could but this way will produce extra database queries for getting comments count. You can insert with same way new column for comments and in the second part of your patch you will need to insert next code:

Code: (php)
<td align="center">
<?php
  $comments 
JPATH_SITE '/components/com_jcomments/jcomments.php';
  if (
file_exists($comments)) {
    require_once(
$comments);
    echo 
JComments::getCommentsCount($item->id'com_content');
  }
?>

</td>
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Outbreaker
Full Member
***

Karma: 3
Offline Offline

Posts: 55


Email
« Reply #4 on: December 08, 2010, 12:34:19 »

The comment code worked Smiley
The only problem i still have is that the up and down sorting option doesn't work for Ratings and Comments i looked at the code but can't find anything that i have missed to included. Huh

components/com_content/views/category/tmp/default_items.php
Code:
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>

<script language="javascript" type="text/javascript">

function tableOrdering( order, dir, task )
{
var form = document.adminForm;

form.filter_order.value = order;
form.filter_order_Dir.value = dir;
document.adminForm.submit( task );
}
</script>
<form action="<?php echo $this->action?>" method="post" name="adminForm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php if ($this->params->get('filter') || $this->params->get('show_pagination_limit')) : ?>
<tr>
<td colspan="5">
<table>
<tr>
<?php if ($this->params->get('filter')) : ?>
<td align="left" width="60%" nowrap="nowrap">
<?php echo JText::_($this->params->get('filter_type') . ' Filter').'&nbsp;'?>
<input type="text" name="filter" value="<?php echo $this->escape($this->lists['filter']);?>" class="inputbox" onchange="document.adminForm.submit();" />
</td>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<td align="right" width="40%" nowrap="nowrap">
<?php
echo '&nbsp;&nbsp;&nbsp;'.JText::_('Display Num').'&nbsp;';
echo $this->pagination->getLimitBox();
?>

</td>
<?php endif; ?>
</tr>
</table>
</td>
</tr>
<?php endif; ?>
<?php if ($this->params->get('show_headings')) : ?>
<tr>
<td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" align="right" width="5%">
<?php echo JText::_('Num'); ?>
</td>
<?php if ($this->params->get('show_title')) : ?>
  <td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" >
<?php echo JHTML::_('grid.sort',  'Item Title''a.title'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('show_date')) : ?>
<td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="25%">
<?php echo JHTML::_('grid.sort',  'Date''a.created'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('show_author')) : ?>
<td class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"  width="20%">
<?php echo JHTML::_('grid.sort',  'Author''author'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('show_hits')) : ?>
<td align="center" class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="5%" nowrap="nowrap">
<?php echo JHTML::_('grid.sort',  'Hits''a.hits'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<td align="center" class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="5%" nowrap="nowrap">
<?php echo JHTML::_('grid.sort',  'Rating''rating'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<td align="center" class="sectiontableheader<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>" width="5%" nowrap="nowrap">
<?php echo JHTML::_('grid.sort''Comments''contents'$this->lists['order_Dir'], $this->lists['order'] ); ?>
</td>
<?php endif; ?>
</tr>
<?php endif; ?>
<?php foreach ($this->items as $item) : ?>
<tr class="sectiontableentry<?php echo ($item->odd +) . $this->escape($this->params->get('pageclass_sfx')); ?>" >
<td align="right">
<?php echo $this->pagination->getRowOffset$item->count ); ?>
</td>
<?php if ($this->params->get('show_title')) : ?>
<?php if ($item->access <= $this->user->get('aid'0)) : ?>
<td>
<a href="<?php echo $item->link?>">
<?php echo $this->escape($item->title); ?></a>
<?php $this->item $item; echo JHTML::_('icon.edit'$item$this->params$this->access?>
</td>
<?php else : ?>
<td>
<?php
echo $this->escape($item->title).' : ';
$link JRoute::_('index.php?option=com_user&view=login');
$returnURL JRoute::_(ContentHelperRoute::getArticleRoute($item->slug$item->catslug$item->sectionid), false);
$fullURL = new JURI($link);
$fullURL->setVar('return'base64_encode($returnURL));
$link $fullURL->toString();
?>

<a href="<?php echo $link?>">
<?php echo JText::_'Register to read more...' ); ?></a>
</td>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->params->get('show_date')) : ?>
<td>
<?php echo $item->created?>
</td>
<?php endif; ?>
<?php if ($this->params->get('show_author')) : ?>
<td >
<?php echo $this->escape($item->created_by_alias) ? $this->escape($item->created_by_alias) : $this->escape($item->author); ?>
</td>
<?php endif; ?>
<?php if ($this->params->get('show_hits')) : ?>
<td align="center">
<?php echo $this->escape($item->hits) ? $this->escape($item->hits) : '-'?>
</td>
<td align="center">
<?php echo $this->escape($item->rating) ? $this->escape($item->rating) : '-'?>
</td>
<td align="center">
<?php $comments JPATH_SITE '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once($comments);
echo JComments::getCommentsCount($item->id'com_content'); } ?>

</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<?php if ($this->params->get('show_pagination')) : ?>
<tr>
<td colspan="5">&nbsp;</td>
</tr>
<tr>
<td align="center" colspan="4" class="sectiontablefooter<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->pagination->getPagesLinks(); ?>
</td>
</tr>
<tr>
<td colspan="5" align="right">
<?php echo $this->pagination->getPagesCounter(); ?>
</td>
</tr>
<?php endif; ?>
</table>

<input type="hidden" name="id" value="<?php echo $this->category->id?>" />
<input type="hidden" name="sectionid" value="<?php echo $this->category->sectionid?>" />
<input type="hidden" name="task" value="<?php echo $this->lists['task']; ?>" />
<input type="hidden" name="filter_order" value="" />
<input type="hidden" name="filter_order_Dir" value="" />
<input type="hidden" name="limitstart" value="0" />
<input type="hidden" name="viewcache" value="0" />
</form>
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #5 on: December 08, 2010, 19:00:08 »

The only problem i still have is that the up and down sorting option doesn't work for Ratings and Comments i looked at the code but can't find anything that i have missed to included. Huh
It will not work until you've made more hard modification of com_content's code - you need to edit SQL-query for this view and add selection of comments count and adjust sorting options. This isn't too easy task for novice but you can try to made it.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Outbreaker
Full Member
***

Karma: 3
Offline Offline

Posts: 55


Email
« Reply #6 on: December 08, 2010, 21:49:24 »

Ok i see didn't know that i needed to do so much to get this little sort option to work. THX for the help Wink
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: Comments counts in Article Categorys
 
Jump to: