Posted by whisk2 on December 1, 2012 at 1:28pm
Hi,
I'm trying to access the value of a cck field, and tried
$node -> field_title_hide['0']['value']
but no results.
Any suggestions?
Thanks!
Hi,
I'm trying to access the value of a cck field, and tried
$node -> field_title_hide['0']['value']
but no results.
Any suggestions?
Thanks!
Comments
You probably want $node ->
You probably want $node -> field_title_hide['und']['0']['value'].
Although the above will work
Although the above will work in this case, remember that, in general, it's best to use
field_get_items()so that you don't run into language problems.<?php$values = field_get_items('node', $node, 'field_title_field'); // this will return an array
$value = $values[0]['value']; // this will give the value for the first item in the array
?>