We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

Leech on 12/21/07


Tagged

insert drupal cck


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

basicmagic
panatlantica


Insert CCK node from PHP script


Published in: PHP 


Here's a nice example where I've taken inspiration [?] http://drupal.org/node/82661#comment-153461

  1. $node = new StdClass();
  2. $node->title = "test3";
  3. $node->type = 'clasificados';
  4. $node->body = "booooooooody";
  5. $node->status = 1;
  6. $node->format = 1;
  7. $node->moderate = 0;
  8. $node->promote = 0;
  9. $node->sticky = 0;
  10. $node->revision = 0;
  11. $node->field_contenido = array(0 => array('value' => 'no mas de 140 caracteres en este texto'));
  12. $node->field_autor = array(0 => array ('value' => 'alguntwitter'));
  13. $node = node_submit($node);
  14. node_save($node);

Report this snippet 

You need to login to post a comment.