【问题标题】:How can I print image field inside <img src=""> inside my custom views-view-fields.tpl.php如何在自定义views-view-fields.tpl.php中的<img src="">中打印图像字段
【发布时间】:2016-04-10 16:07:18
【问题描述】:

我对新闻内容类型有一个看法 我覆盖了视图的模板网格样式输出 在行样式输出中:views-view-fields.tpl.php 覆盖所有东西似乎都可以,除了图像字段! 我使用 print 打印倾斜和描述以及其他所有内容 `$fields['fieldname']->内容;

但是打印 $fields['field_teamimage']->content; " class="img-respo" alt="团队 img 1"> 什么都不显示!

如何在内部打印图像字段 只允许本地图像。在我的自定义views-view-fields.tpl.php中 我整天都在尝试和搜索,但没有结果 谢谢

【问题讨论】:

    标签: drupal


    【解决方案1】:

    为此,您需要覆盖已归档的模板文件 Field Content: Images of property (ID: field_teamimage),然后您可以在其中添加 img src,类似于

    <img class="img-responsive" alt="team img 1" src="<?php print file_create_url($row->_field_data['nid']['entity']->field_teamimage['und'][0]['uri']); ?>"/>
    

    你甚至可以直接在src中添加图片src。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-07
      • 1970-01-01
      • 2012-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多