By palabat on
Hello.
Has anyone tried updating nodes programmatically in Drupal 5?
I'm particularly interested in how to reflect changes in the node body and be able to save them programmatically.
Thanks.
Pol
Hello.
Has anyone tried updating nodes programmatically in Drupal 5?
I'm particularly interested in how to reflect changes in the node body and be able to save them programmatically.
Thanks.
Pol
Comments
Are you talking of a
Are you talking of a computed fields?? Can you elaborate your requirement?
Try using CCK and computed fields to have nodes updated programatically.
Shyamala
Team Leader Netlink Technologies Ltd.
Shyamala
http://www.unimitysolutions.com
What I want to do is to save
What I want to do is to save the changes on the node object into the database programmatically.
The way I intend to do it is:
Load the node object using node_load($nid).
Modify the $node->body.
Save the modified $node object as if submitting values from the edit node form.
Please help if it can be done.
Thanks.
Use node_submit() followed by node_save()
Given you have a node object you can do this
Thanks for your
Thanks for your suggestion.
There must be a reason why I need to use node_submit method and not go directly to node_save.
Which method ensures that I'm not duplicating a node if a node of the same nid exists?
node_save() handles the question of new vs existing
node_submit() does both some sanity checks, initializing of unset data and probably most importantly calls both the submit hook for the content type and any nodeapi hooks with an op of 'submit'. These actions make sure any data not related to the core definition of a node gets saved. Some examples would taxonomy terms and CCK fields.