I have searched everywhere for this answer but I can't find it.

I really like the new layout overrides in Joomla 3 but I want to be able to add a link to the intro_image.php file so that when a user clicks on a intro image they are taken to the full article.

Most of the answers I have found suggest removing the override and placing the php directly into the template override but this is really a backwards step.

I would really like to keep my layout override but add a link to it. It seems simple but I can't figure it out.

2 Answers 2


The intro image is generated in the JLayout layouts/joomla/content/intro_image.php.

You can override this in your own template in /templates/your_template/html/layouts/joomla/content/intro_image.php.

Just copy the file there and adjust as needed. I think you should be able to generate a link there.

To generate the link, you can use JRoute::_(ContentHelperRoute::getArticleRoute($displayData->slug, $displayData->catid));.

  • Hi Bakual, I have already gotten that far, it's the link I am having problems with not overriding the layout. Jul 9, 2014 at 13:23
  • 1
    What exactly is the problem with the link? You should be able to generate it using JRoute::_(ContentHelperRoute::getArticleRoute($displayData->slug, $displayData->catid)); or similar.
    – Bakual
    Jul 9, 2014 at 14:28
  • Hi Bakual. The problem that with the link was that I didn't know the code to generate it but your answer is perfect, thank you :) If you update your original answer I will accept it if you like? Jul 9, 2014 at 20:20
  • Added to answer :)
    – Bakual
    Jul 9, 2014 at 21:02

Intro Image with link to the article : Template override

Following Bakual's answer on **where to place the override for the intro-image**, here is a sample code for a template override for intro-image layout, that linking to the article. It checks if the user has view access to read the full article and then generates the link accordingly (same like the generation of the article title).
defined('_JEXEC') or die;

$params  = $displayData->params;
if ($params->get('access-view')) :
    $link = JRoute::_(ContentHelperRoute::getArticleRoute($displayData->slug, $displayData->catid));
else :
    $menu = JFactory::getApplication()->getMenu();
    $active = $menu->getActive();
    $itemId = $active->id;
    $link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
    $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($displayData->item->slug, $displayData->item->catid));
    $link = new JUri($link1);
    $link->setVar('return', base64_encode($returnURL));
endif; ?>

<?php $images = json_decode($displayData->images); ?>
<?php if (!empty($images->image_intro)) : ?>
    <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
    <div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image">
        <a href="<?php echo $link; ?>">
            <?php if ($images->image_intro_caption):
                echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_intro_caption) . '"';
            endif; ?>
                src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>" itemprop="thumbnailUrl"/>
<?php endif; ?>

Further References:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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