Hi, I've been trying to get the quantity inserted within the latest news module. No luck so far!
Could someone give a clue, please:
This is the code:
mod_latestnews/helper.php:
$i = 0;
$lists = array();
$jcommentsFile = JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($jcommentsFile)) {require_once($jcommentsFile);
//$id = $this->item['object_id'];
$count2 = JComments::getCommentsCount($id, 'com_content');
}
foreach ( $rows as $row )
{
if($row->access <= $aid)
{
$lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
} else {
$lists[$i]->link = JRoute::_('index.php?option=com_user&view=login');
}
$lists[$i]->comments = $count2;
$lists[$i]->text = htmlspecialchars( $row->title );
$lists[$i]->created = JHTML::_('date', $row->created, JText::_('%d-%m'));
$title_max = 30;
if ( strlen($row->title) > $title_max ) {
$lists[$i]->text2 = substr( htmlspecialchars($row->title), 0, $title_max - 3 ) . '...';
}
else {
$lists[$i]->text2 = htmlspecialchars( $row->title );
}
$i++;
}
return $lists;
}
}
And in the default.php:
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<?php foreach ($list as $item) : ?>
<img src="/images/M_images/indent1.png" alt="">
<?php echo $item->created; ?>
<a href="<?php echo $item->link; ?>" title='<?php echo $item->text; ?>' class="<?php echo $params->get('moduleclass_sfx'); ?>">
<?php echo $item->text2; ?>
</a><?php if (isset($item->comments)) : ?><span><?php echo JText::_('(') . $item->comments .(')'); ?></span><?php endif; ?><br>
<?php endforeach; ?>
<a href="index.php/laatste-nieuws.html" title="More news"><?php echo '<b><img src="/images/M_images/indent1.png" border="0" alt="More news!"> More...</b>'?></a>
If someone has a clue, very much appriciated
