質問
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_image['data']['alt'], $cck_image['data']['title']);
print $image;
endforeach;
endif;
?>
しかし、Drupal 7には「['filepath']」はありません。私は以下を試してみました。
<?php print_r($field_image); ?>
しかし、変数はそこにありません。 Drupal 7がまだアルファにあることは知っていますが、どんな助けも大歓迎です!
解決
これを試して:
<?php
$nid = 4;
$node = node_load($nid);
?>
<img src="<?php echo render(file_create_url($node->field_image['und'][0]['uri'])); ?>" />
所属していません StackOverflow