Thanks for any help with this.

I'm trying to display an image from another node using node_load and imagecache by doing the following:

<?php
//if the CCK node reference field exists
 if ($field_inline_1_stock) { 
//load the node
node_load($node->field_inline_1_stock[0]['nid']); 
//display an image from the node using theme imagecache
print theme('imagecache', '720px_wide', $node->field_stock_picture[0]['filepath']); } ?>

I must not be loading the node properly or completely because I am not seeing the ['filepath'] array imagecache needs to display the image using <?php print_r($node); ?>

Can anyone recommend an approach to get this working?
Thank you,
Scott

Comments

sovarn’s picture

in line 2 try writing $node = .

<?php
$node = node_load($node->field_inline_1_stock[0]['nid']); 
?>
Sc0tt’s picture

I only see the loaded node's arrays and have lost my original node's arrays. Is there any way to keep the original node data?

Sc0tt’s picture

Instead of using $node, I used $ref_node:

<?php if ($field_inline_1_stock) { 
$ref_node = node_load($node->field_inline_1_stock[0]['nid']);
print theme('imagecache', '200px_wide', $ref_node->field_stock_picture[0]['filepath']); } ?>

Thanks very much for your help!
Scott

sovarn’s picture

instead of $node, try $new.
just use a different variable name than node.
Remember to change it in the theme (line 3).

edit: you answered it before me :)