日期:2017-01-16 阅读:2459
dmandwp系统 - wordpress系统和DM系统区块建站>>
在tvblock里,通过field_collection 模块来获得结果。
<ul class="slides"> <?php $node = node_load($nid); $tvblock = field_get_items('node', $node, 'field_tvblock'); foreach ($tvblock as $key => $v2) { $item = field_collection_field_get_entity($v2); // pre($item); $title = isset($item->field_title['und'][0]['value']) ? $item->field_title['und'][0]['value'] : ''; $linkurl = isset($item->field_linkurl['und'][0]['value']) ? $item->field_linkurl['und'][0]['value'] : ''; // $blockbody = isset($item->field_blockbody['und'][0]['value']) ? $item->field_blockbody['und'][0]['value'] : ''; if(isset($item->field_image['und'][0]['uri'])) { $image = $item->field_image['und'][0]['uri']; $image = file_create_url($image);//大图片 } else $image =''; echo '<li>'; if($linkurl<>'') echo '<a target="_blank" title="'.$title.'" href="'.$linkurl.'">'; echo '<img src="'.$image.'" alt="'.$title.'" />'; if($linkurl<>'') echo '</a>'; print '<p class="flex-caption">'.$title.'</p>'; echo '</li>'; } ?> </ul>