cck display field set to “file path”
using fields in php functions in node-content.tpl.php file

expression: print $node->field_content_image[0]['view']
renders as: sites/default/files/content/image.jpg (just like the book says)

expression: $path = print $node->field_ content _image[0]['view']; print $path;
renders as: sites/default/files/content/image.jpg 1
and variable $path cannot be used in string or array php expressions

same thing goes with: $node->field_content_image[0]['value']
also with: $field_content_image[0]['view']

what am I missing here?

thanks

Comments

nevets’s picture

I am not sure 'print' returns anything so it is unclear what $path would hold after

$path = print $node->field_ content _image[0]['view'];

Maybe you mean to use

$path = $node->field_ content _image[0]['view'];
droweski’s picture

Got so busy trying to figure out Drupal, I forgot my php!