I'm using the mod_mostread core joomla module to display the most active articles on my site. I edited this module to also include a link to the category of the articles.
The original link to the article automatically redirects to the com_flexicontent address; however, when I added the link to the category it is still using the com_content address. How do I change this to link automatically to the com_flexicontent category view?
I edited the function in the mod_mostread helper.php to read the following:
Code:
foreach ( $rows as $row )
{
$lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
$lists[$i]->text = htmlspecialchars( $row->title );
$lists[$i]->catlink = JRoute::_(ContentHelperRoute::getCategoryRoute($row->catslug, $row->sectionid)); //edited for trying to get Popular to display the category link
$lists[$i]->hits = $row->hits;
$lists[$i]->catid = $catid;
$i++;
}
so that it passes through the category link and displays it in the default.php with this:
Code:
<?php foreach ($list as $item) : ?>
<li class="mostread<?php echo $params->get('moduleclass_sfx'); ?>">
<a href="<?php echo $item->link; ?>" class="mostread<?php echo $params->get('moduleclass_sfx'); ?>"<?php if($params->get('showhits')) echo ' title="'.$item->hits.' '.$params->get('hitstext').'"'; ?>>
<?php echo $item->text; ?>
( <a href="<?php echo $item->catlink; ?>" class="mostread<?php echo $params->get('moduleclass_sfx'); ?>">
category <?php echo $item->catid; ?> )
</li>
<?php endforeach; ?>
I basically just copied the code the way the mod_mostread file was already doing it, assuming it would be automatically redirected to flexicontent like the article address is.
What am I doing wrong so that its not kicking in the Flexicontent category view?
I'm very new to the php/sql thing, but trying to learn, so thanks for any ideas.