phpjoomlajoomla3.0joomla-template

Show Intro Image in Joomla Category Listing menu


I'm working on Joomla 3.4.5 and I added these two lines in my override file for Category List menu

$images  = json_decode($this->item->images);
<?php echo $article->images; ?>

and the result is this:

{"image_intro":"images\/articles\/liangmai2.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}

The path images\/articles\/liang2.jpg is correct without the backslash. Now, How do I make this display it as <img src="images/articles/liang2.jpg"> and also remove the backslash?

Thanks.


Solution

  • You need to do changes in the file located at : Modules/mod_article_category/tmpl/default.php There in else condition i.e Not Grouped one add these lines in foreach loop in between your li tags :

     $article_images = $item->images; // Get image parameters of the article
    
     $pictures = json_decode($article_images); // Split the parameters apart
    
     echo "img src='" . $pictures->{'image_intro'} . "' alt='" . $pictures->{'image_intro_alt'} . "'>"; // get the intro image