[development] The state of import export
Nancy Wichmann
nan_wich at bellsouth.net
Tue Jan 29 01:00:06 UTC 2008
Here's what I do in the Faq_Ask module:
<code>
$node = array(
'type' => 'faq',
'body' => '', /* Empty string rather than null. */
'title' => $form_values['title'],
'taxonomy' => array($category => $term),
'created' => time(),
'uid' => $user->uid,
'name' => $user->name,
'status' => 0, /* Unpublished. */
'format' => 1, /* Default filter (filtered HTML) */
'comment' => variable_get('comment_faq', 0),
);
// Okay, let's get it done. Node_submit will prepare it and make it an
object.
$node = node_submit($node);
node_save($node);
</code>
Nancy E. Wichmann, PMP
From: Roman Chyla
>as you see, many people are trying to construct node array and submit it to
node_save() however, would it be possible with Drupal to do something like
this?
>
>$new = get_new_node('article');
>$new->add('title', 'Hello world');
>$new->add('userid', 1);
>$new->commit;
More information about the development
mailing list