I want to retrieve field values of some nodes in Drupal 6. Can I do this without writing a module as it is a small thing. Can I do it using Drush,how to write a drush script for that?
Please anyone help me?
You can write your function in template.php file as you don't want to create a new module. But it is not recommended. It is better to have a common module for the whole project for this kind of functions.
You can use the "php-eval" drush argument, abbrevated with "eval":
drush @mysite eval '$nid = 12; $node = node_load($nid); var_export($node, TRUE);'
I wrote this script explicit, here is the shortened version:
drush @mysite eval 'var_export(node_load(12), TRUE));'
Running this command you get to know the structure of the node object. If you know the field name, then run it like this:
drush @mysite eval 'var_export(node_load(12)->field_body, TRUE));'
The essence is: Take drush eval
and run node_load()
to get the node object.