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

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?