Drupal get a CKK field from a node object -
I am using the rule module to send an email I need to include a CCK field from my node in the email I Rule Module provide $ node object. How do I get my field from this object so that I can get it out in the email?
Debug by dumping the node object you can:
Var_dump ($ node);
or (my preference) You can use the dBug.php script to include that script and
create new debug ($ node) ;
This will make the dump easier to read.
However, in your node object there will be the CCK field marked as field_ (name). So if you had a CCK area called a telephone, then it would be in the node object with its properties as field_telfone.
If these fields are unavailable, the node may not be fully loaded. I have seen that this will happen. If yes, then you can do this:
$ full_node = node_load ($ node-> nid); Var_dump ($ full_node);
This will be a fully loaded node object, then point to the correct field in your email script / tip, though you are doing it, and if there is a value it will be sent.
Comments
Post a Comment