How to programmatically create nodes and fill in field data?
gengel - August 7, 2008 - 22:52
Hey all,
I was wondering if there was an easy way in Drupal 6 to instantiate a new node and fill in some CCK fields with data, and then save it to the database? (Without using my own SQL, ideally)
Specifically, I need to create a new node and fill in some data for the a CCK nodereference field and change set the author.
More ideally, I could even create generate content types and add fields to them programmatically, and then also populate some nodes of this type with data. But for now, I'll settle for just creating nodes and populating them.
Any suggestions?
Thanks in advance!

check the modul node_factory
try the module "node_factory". I try this myself at the moment, and a first test is okay.
I just managed how to set cck fields, please find hints in this thread: http://drupal.org/node/202901
You can try using
You can try using drupal_execute() to run the node creation form processing. You would have to create an array of node fields, fill it out and pass it to the drupal_execute() function.
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials