Aller au contenu principal

test1

Soumis par admin le
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))'.
admin
To set a node’s creation time, you’d think you could just set $node->created. And you can - if you don’t use node_submit() (or if you set it after node_submit()). Looking at the node_submit() function in node.module, we find this line:
lun, 15/12/2014 - 06:22 Permalien
admin

En réponse à par admin

Which means that 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:
lun, 15/12/2014 - 06:23 Permalien