Php 在Drupal 7中获取字段\图像路径
在Drupal 6中,我将执行以下操作以在我的节点--articles.tpl.php页面中获取图像:Php 在Drupal 7中获取字段\图像路径,php,drupal-7,Php,Drupal 7,在Drupal 6中,我将执行以下操作以在我的节点--articles.tpl.php页面中获取图像: <?php $cck_images = $node->field_image; if (count($cck_images)>0) : foreach ($cck_images as $cck_image) : $image = theme('imagecache', 'large', $cck_image['filepath'], $cck_ima
<?php
$cck_images = $node->field_image;
if (count($cck_images)>0) :
foreach ($cck_images as $cck_image) :
$image = theme('imagecache', 'large', $cck_image['filepath'], $cck_image['data']['alt'], $cck_image['data']['title']);
print $image;
endforeach;
endif;
?>
但是,在Drupal 7中没有“['filepath']”,我尝试使用:
<?php print_r($field_image); ?>
但变量并不存在。我知道Drupal7仍然在alpha中,但是任何帮助都将不胜感激 试试这个:
<?php
$nid = 4;
$node = node_load($nid);
?>
<img src="<?php echo render(file_create_url($node->field_image['und'][0]['uri'])); ?>" />
字段_图像['und'][0]['uri']);?>" />
试试这个:
<?php
$nid = 4;
$node = node_load($nid);
?>
<img src="<?php echo render(file_create_url($node->field_image['und'][0]['uri'])); ?>" />
字段(图像['und'][0]['uri']);?>“/>