Is Programatic CCK Possible in Drupal 6 ?

kuldip - Gloscon - June 27, 2008 - 11:08

Hello Experts..

I am developing installer profile in Drupal 6 , i want to import my CCK's from the text file

i have tried this code but its not working for me,

<?php
 
include_once('./'. drupal_get_path('module', 'node') .'/content_types.inc');
  include_once(
'./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');

 
$values = array();
 
$values['type_name'] ='<create>';
 
$values['macro'] = implode("\n", file(dirname(__file__)."/cck_import.txt"));
 
drupal_execute("content_copy_import_form", $values);
?>

so please help me....

Drupal 6

chris_lu - July 29, 2008 - 10:03

Try the fallowing:

<?php
 
include_once('./'. drupal_get_path('module', 'node') .'/content_types.inc');
  include_once(
'./'. drupal_get_path('module', 'content') .'/includes/content.admin.inc');

 
$values = array();
 
$values['type_name'] ='<create>';
 
$values['macro'] = implode("\n", file(dirname(__file__)."/cck_import.txt"));

 
$form_state = array();
 
$form_state['values'] = $values;
 
drupal_execute("content_copy_import_form", $form_state);
?>

i am getting this warnings

kuldip - Gloscon - July 30, 2008 - 04:53

hi chris,

thanks for the reply

i am getting following warning while using above code

* warning: Missing argument 2 for drupal_retrieve_form() in /var/www/d6/includes/form.inc on line 318.
* warning: Missing argument 3 for drupal_process_form(), called in /var/www/d6/includes/form.inc on line 295 and defined in /var/www/d6/includes/form.inc on line 389.

 
 

Drupal is a registered trademark of Dries Buytaert.