Sarkari Naukri and Naukri

Wednesday, 3 April 2013

How to save node in drupal 6

<?php
$orig
= node_load(); // load original$node = $orig;       // copy for mods $node->teaser = 'nah, nah, nah, nah, boo, boo'; // Do some changes node_save($node); // save your changes if ($node->changed != $orig->changed)
{
  
drupal_set_message('Updated');
}
else
{
 
drupal_set_message('Unable to update.');
}
?>
If your node type is saving revisions, you could technically use $node->vid instead of $node->changed in the same manner, however if your node type ISN'T saving revisions, you need to use $node->changed.

No comments:

Post a Comment