I have a CCK select list where I defined key|value pairs.

When I execute a node_load for that node, I only get the key (in my case an integer) stored in Drupal.

How can I get the value of that key easily? Is there a Drupal function?

something like, cck_value('field_name',$key) ?


Node_load will return fully-populated node object.

Value of cck fields in node object are usualy accessed in this way:

 $my_node_object = node_load($nid);
 $myVar = $my_node_object->field_your_field_name['0']['value']

You can see what $node object contain if you do

dsm($my_node_object); // Devel module must be turned on

Hope this helps.


Found this meanwhile http://www.mugginsoft.com/content/getting-allowed-values-cck-field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.