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

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改