Adding database content directly for a CCK content type (dynamic content)

jpermar - December 5, 2008 - 21:15

Hello! First, I'm a complete newbie to Drupal, so I'm hoping you can point me in the right direction.

I just installed CCK and created a content type. It created a new table in my drupal database for my content type. The CCK instructions specify how to create new content using the drupal interface, but that's not what I need to do. I need to create content directly in the database.

My end goal is to run a program that dumps data into the drupal database so I can display it on the drupal site. (As an aside, maybe I'm using the wrong approach and should input a php page in a regular content type that simply pulls data from the database to display?).

So, how can I add new content directly to the database instead of using the GUI... maybe there is a core module that has functions that I can use to do this?

Thanks in advance!

Don't add to the db directly

markj - December 5, 2008 - 21:59

A Drupal node is fairly complex, so you probably don't want to add content directly to the database. Instead, you have several options:

1) Use an existing module that can handle CCK (see http://drupal.org/project/Modules/category/64)

2) Use http://drupal.org/project/node_factory, which provides an API for programmatically creating nodes

3) Use a lower-level approach like the one described at http://acquia.com/blog/migrating-drupal-way-part-i-creating-node

The last one is the most flexible, of course.

Mark

Thanks

jpermar - December 6, 2008 - 03:49

Mark, I really appreciate your links. The last one especially looks like what I need. I'll do some hacking over the weekend to figure this out...

Thanks

pioters - June 9, 2009 - 13:08

Thank you for the options, going to try the last one.
Pioter

 
 

Drupal is a registered trademark of Dries Buytaert.