我在View的tpl.php中创建了foreach,它看起来像这样:
<div class="carousel-inner">
<?php foreach($view->result as $result): ?>
<div class="item active">
<div class="col-xs-2 no-pad"><img src="<?php print file_create_url($result->field_field_client_image[0]['raw']['uri']); ?>" class="img-responsive"></div>
</div>
<?php endforeach; ?>
</div>
我的视图只有一个图像字段。现在我有两个节点,每个节点只有一个图像,我应该得到输出:
<div class="carousel-inner">
<div class="item active">
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
</div>
<div class="item active">
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
</div>
</div>
但我得到了:
<div class="carousel-inner">
<div class="item active">
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
</div>
<div class="item active">
<div class="col-xs-2 no-pad"><img src="link_to_image_2" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
<div class="col-xs-2 no-pad"><img src="link_to_image" class="img-responsive"></div>
</div>
</div>
这很奇怪。
我通过“视图”显示的内容类型只有一个图像字段,仅限于1个图像文件。
有人知道可能出现的问题是什么吗?