I want to show my article intro text and item image with link to the full article in the result page for Joomla Tags.

Is there a way to do this, or how can I modify the code to get the expected results?

I tried to add in components\com_tags\views\tag\tmpl\default_items.php <?php echo $this->item->introtext; ?> but it does not work there as in other cases. I do not know php well enough, so would like to know if there are other suggestions.


| improve this question | | | | |

Try this(tested and worked in Joomla 3.3.0):

Put this code:

echo $item->text;
$images  = json_decode($item->core_images);
echo '<img src="'.$images->image_intro.'">';
//get category name by id
$db = JFactory::getDbo();
$id = $item->core_catid;
$db->setQuery("SELECT cat.title FROM #__categories cat WHERE cat.id='$id'");
$category = $db->loadResult();
echo '<p>'.$category.'</p>';

into this file:


that should be copied from:


between this two lines

<?php foreach ($items as $i => $item) : ?> //Line 63 <?php endforeach; ?>

You can use any of this variables(<?php echo $item->useonefromthelist; ?>) to modify the tag output:


How i get this list?

<?php print_r($item); ?>
| improve this answer | | | | |
  • Firstly, I am doing the override, no worries about this. Secondly, I do not manage to get the wanted result anyway. Which of this variables can give me back the intro text for the articles? What I want is when clicking on a tag in the tag cloud it opens the result page with articles with their intro text and image as in category blog, not only the title as it is now. Is there a way to get this? – gag May 14 '14 at 18:03
  • My code does exactly what you need. Look here: projekte.joomla-agentur.de/law-olesch/index.php/de/component/… This is the Tags page with an image and the intro text. I Update my answer. Try it. – Joomla Agency May 14 '14 at 18:26
  • That's great, it works as I need. I even put the code on line 72 (after <h3>) and get link to my article. Thanks a lot. Sorry, I do not have enough reputation to vote for you(. – gag May 14 '14 at 19:14
  • And I would like to ask one more question. As far as I understand we cannot retrieve Category Name and link to the category here, or can we? – gag May 14 '14 at 19:43
  • check the answer :-) – Joomla Agency May 14 '14 at 23:25

1stly, directly editing the template override in situ is not recommended.

Google html overrides for more info but in short, for the case above:

  • copy the tmpl folder from components\com_tags\views\tag to templates/yourtemplate/html/com_tags/
  • rename it to tag

You can edit it there where it won't get overwritten after an update.

For what you want to do above I think you'll find this more complicated than you think. What output would you want where a tag is linked to more that one article? What I would do here is have a look at modifying a module that already does most of what you want. Something like the "Similar Tags" module. It would be easier to make a modified version of that and call that into the tag result page.

| improve this answer | | | | |
  • 1
    No, I don't want to link a tag to more articles. I want to click on the tag in the tag cloud module and as a result see something similar with standard joomla category blog, with article intro texts and intro images. Now instead I get only the titles of the articles. – gag May 14 '14 at 18:06
  • As I said this would need to be modified. @Joomla Agencys' modified code will provide your requirements. – BodgeIT May 15 '14 at 5:59

This solution worked very well for myself. The intro text was still too long so I shortened it to 300 characters. See below. I added the main code in the first answer above right after the h3 tag and then just modified the intro text portion. I didn't use the category name. I added the link to the main article in the read more link and also for the ...

Here is the total code I used in Joomla 3.6, including the h3 tag...

<a href="<?php echo JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router)); ?>">
<?php echo $this->escape($item->core_title); ?>

$images  = json_decode($item->core_images);
echo '<p><img class="intro-image" src="'.$images->image_intro.'"></p>';                  
$limit =300;
if (strlen($item->text) > $limit) {
echo (substr($item->text, 0, $limit)) ?> <a href="<?php echo JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router)); ?>">...</a>
else {
echo $item->text;
<a class="read-more" href="<?php echo JRoute::_(TagsHelperRoute::getItemRoute($item->content_item_id, $item->core_alias, $item->core_catid, $item->core_language, $item->type_alias, $item->router)); ?>">Read more</a>
| improve this answer | | | | |

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.