1

I am making a module and trying to figure out how to get the Search engine friendly url to articles from this module

this is the helper class today

public function getItems($amount)
{
$db = &JFactory::getDBO();


$query = 'SELECT * FROM `#__content`, `#__content_frontpage` WHERE `#__content_frontpage`.content_id = `#__content`.id AND `#__content`.state = 1 ORDER BY `#__content`.publish_up DESC LIMIT ' . $amount  . '';



$db->setQuery($query);
$items = ($items = $db->loadObjectList())?$items:array();



return $items;
} //end getItems

And this is the default.php to display stuff

<ul class="frontpage_news">
    <?php foreach ($items as $item) { ?>
    <li>
    <div class="frontpage_date"><?php echo JText::sprintf('DATE_FRONTNEWS', $item->publish_up); ?></div>
    <div id="ffTitle" class="frontpage_title"><a href="#"><?php echo JText::sprintf('TITLE_FRONTNEWS', $item->title); ?></a></div>
    <div id="ffRead" class="frontpage_readmore"><a href="#"><?php echo JText::sprintf('READ_MORE_FRONTNEWS'); ?></a></div>
    </li>
    <?php } ?>
</ul>

So how do I get the correct link to each article displayed in SEF format?

Thanks for any help!

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Tobias
  • 494
  • 3
  • 14
  • 30

1 Answers1

4

For Joomla 1.5:

echo JRoute::_(ContentHelperRoute::getArticleRoute($article_id_and_alias, $category_id_and_alias, $section_id));

For Joomla 1.6/1.7:

echo JRoute::_(ContentHelperRoute::getArticleRoute($article_id_and_alias, $category_id));
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Hackwar
  • 353
  • 2
  • 5
  • Thanks! found a great article about it here! to http://www.joomladin.com/index.php/tutorials/34-module-development/57-link-to-an-article.html – Tobias Sep 23 '11 at 08:13