1

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) ?

1

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.

0

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

  • If you think this is the solution to your question, please accept your own answer! Thanks! – Sk8erPeter Jan 8 '12 at 3:12

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.