dongyue8640 2015-12-01 23:20
浏览 70
已采纳

在Joomla类别列表菜单中显示简介图像

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.

  • 写回答

1条回答 默认 最新

  • dougao2830 2015-12-02 09:56
    关注

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?