Here's a simple chunk of code for creating nodes. Hopefully it will help:
$nodeArray = array( 'type' => 'node_content_type', // Pick the content type you want the node to fall under 'status' => '1', // Published or not 'promote' => '0', // Promoted to front page or not 'comment' => '0', // Allow comments or not 'uid' => $user->uid, // User ID 'date' => format_date(time(), 'custom', 'Y-m-d H:i:s O'), );
node_validate($nodeArray); $node = node_submit($nodeArray); node_save($node);
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Nikhil Kala Sent: Friday, April 16, 2010 7:40 AM To: support@drupal.org Subject: [support] How add a node into drupal database directly.
Hello,
Can any one has idea how to add a node into Drupal database directly without using drupal interface? I want to migrate large database into Drupal database and want to create large number of nodes.
What things need for this ? Can I use only SQL scripts only?
Thanks, Nikhil Kala Blogs - http://www.nikhilkala.com Cell : +91-9822602183 | GTalk - kale.nikhil@gmail.com | skype - nikhilkaleus