I am new to Joomla. I have created a module that shows some articles with a link to those articles.

I fetched latest articals with :

<?php $list= ModArticlesLatestHelper::getList($params);
   foreach ($list as $item) :  ?>
     <a href="<?php echo $item->link; ?>" itemprop="url"></a>
<?php endforeach; ?>

i get a url that is in the form


Please tell me how can i get a URL in the following form.


  • Please post your code of how you formed $item->link. – Nagarjun Aug 30 '16 at 7:41
  • @Nagarjun I have edited my question, Please let me know if i need to provide any more details. thanks. – Prakhar Singh Aug 30 '16 at 9:36

Your article urls are managed using menu items. To get the correct menu structure, create one Category List or Category Blog menu item for each of the "Top Level" category. This way, your article urls will look like this:


Or the articles in subcategories:


Now in your module helper class, you can build your article urls using Content component helper.

$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->id,  $item->catid ));

You may need to include the helper in your module.


Note: Your menu items can be under a Menus which you need not show on front-end using Menu module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.