I try to add code in order to display article intro image inside the mod_breadcrumbs.php but I have no luck so far. Any help? I have tried some variations of this code:

$article_images  = json_decode($item->images);
$article_image   = '';
$article_image_alt   = '';
if(isset($article_images->image_intro) && !empty($article_images->image_intro)) {
    $article_image  = $article_images->image_intro;
    $article_image_alt  = $article_images->image_intro_alt;
<a href="/<?php echo $item->link; ?>">
    <img class="" src="/<?php echo $article_image; ?>" alt="<?php echo $article_image_alt; ?>" >
  • How exactly is your code not working? Tip: Never use isset() followed by !empty(). !empty() rules out undeclared and null values. Just use if(!empty($article_images->image_intro)) { Read: stackoverflow.com/a/4559976/2943403
    – mickmackusa
    Nov 11, 2020 at 12:47
  • I have no output...
    – geoplous
    Nov 11, 2020 at 13:59
  • So nothing shows on the webpage. How about in the generated source code? Any clues in the view-source: version of the page? Is the image resource failing to load? Any client-side errors to offer us?
    – mickmackusa
    Nov 11, 2020 at 22:28
  • I have only this html in the page "<a href="/"> <img class="" src="/" alt=""></a>" , so code does not grabing the image
    – geoplous
    Nov 12, 2020 at 7:10
  • Are you able to print $article_images to screen?
    – mickmackusa
    Nov 12, 2020 at 7:12

1 Answer 1


@geoplus, your first hurdle is that mod_breadcrumbs only includes a small amount of information about the breadcrumb items in the array used to display the breadcrumb, specifically the item name and the item link for each breadcrumb.

Add the following in your template override (/templates//html/mod_breadcrumbs/default.php) just inside the foreach loop, and it will show you what's in your array.

echo "<pre>";print_r($item);echo "</pre>";

You'll then see that the array used to display the breadcrumb doesn't have any specific details about the page it links to.

With that as a starting point, you'd then need to look at /modules/mod_breadcrumbs/helper.php and what you can do with the ModBreadCrumbsHelper class, and specifically the getList function.

My suggestion:

  • make a copy of /modules/mod_breadcrumbs
  • rename it /modules/mod_breadcrumbsplus (or whatever you want to call it)
  • Update the XML file to reference different folder name
  • Create new language files as required
  • Discover the new module to install it on the site
  • Go about modifying the helper classes to extend the list to include what you need to acquire the article images and place them in the array.
  • In the template, once the images are included in the array, add that into the layout to then display your images in the breadcrumb.

The mix of code to add to the class needs to include either just the extra images you want to use in the breadcrumb, or to let you further troubleshoot / extend the process, add in fields like menu Itemid, or the article ID.

You can then tweak your template override after those are available to use other tools like Regular Labs Articles Anywhere to then pass the article ID into the layout, and that will let you easily additionally pull in other things like Custom Fields - Showing a full sized intro image in the breadcrumb might be inefficient: A 1200x630 image displayed at a breadcrumb size of 40x21 is not optimal.

  • Hi Patrik, I can follow your thoughts by it is beyong my skills to do it. If you can point me out what I have to add in helper.php and then retrieve it in default .php it would be great.
    – geoplous
    Nov 16, 2020 at 8:39
  • Close to beyond mine as well... Can you post a mockup of what you're trying to do as I can't quite visualise what you're wanting to show where. There might be an alternate way to do something depending on the depth the thumbnail is needed for. Nov 17, 2020 at 8:03
  • I want to use a copy of mod_breadcrumbs and use the current article image as a header background, and breadcrumbs as a header. I just want the code to show the image, then I will use CSS to do the rest.
    – geoplous
    Nov 17, 2020 at 9:22
  • Not the easiest way to go about doing that. If you're not showing the image as part of the breadcrumbs, leave the breadcrumbs alone. I'd look closer at Regular Labs Articles Anywhere that I mentioned in my answer. You can then use a custom module in your header module position, use Articles Anywhere to load the image for the current article, as it will identify that from the article id on page load, and then use module class suffix to give you a standard class used on the module to then use to format the appearance of the image. Nov 19, 2020 at 5:24
  • 1
    You are right Patrick, I used your approach and I did it! Thank you for your persistence to help me find a solution
    – geoplous
    Nov 19, 2020 at 10:23

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.