The best way to see how Drupal nodes are made up, and how to work with the various fields, is to simply look at the structure of an existing node. Just create a new PHP file with the first bunch of lines above (including drupal_bootstrap) and add
print_r(node_load($nid))
, where $nid is the node id. Or use drush: drush php-eval 'print_r(node_load($nid))'
.
$node->created
. And you can - if you don’t usenode_submit()
(or if you set it afternode_submit()
). Looking at thenode_submit()
function innode.module
, we find this line:En réponse à To set a node’s creation time par admin
node_submit()
will set$node->created
to the current time if$node->date
doesn’t exist. So, if you want to set the creation time, you have to do something like this: