Skip to main content

Home/ Drupal for Developers/ Group items tagged drupal_execute

Rss Feed Group items tagged

Daniel Gregoire

drupal_execute | DrupalContrib - 0 views

  •  
    Actual documentation for drupal_execute
Daniel Gregoire

Configuring settings using drupal_execute | drupal.org - 0 views

  •  
    Tagged for D5, but has D6 examples. Using drupal_execute (to be called drupal_form_submit in D7) to set site settings programmatically.
Richard Sheppard

Drupal: Programmaticaly creating nodes | Unofficial, unsactioned stuff out of Byte Craft - 2 views

  •  
    A rough guide to drupal_execute() versus node_save() with a bit of node_submit() on the side.
Daniel Gregoire

Programatic CCK Now Possible! | groups.drupal.org - 2 views

  • <?phpfunction mymodule_enable() {     // Get the files content   $filename = drupal_get_path('module','mymodule') . "/mymodule.cck";  $content = implode ('', file ($filename));      // Build form state    $form_state = array(       'values' => array(            'type_name' => '<create>',            'macro' => $content,      ),     );    // Put it in there     drupal_execute("content_copy_import_form", $form_state);}?>
  •  
    Start with comment 54181 - "This works for me in Drupal 6" and read along.
Daniel Gregoire

Programmatically Create, Insert, and Update CCK Nodes | doug | CivicActions - 2 views

  • Always use content_database_info to get the database info. For example:   $field1 = content_database_info(content_fields('yourfield1', 'yourtable'));  $table1 = $field1['table'];  $column1 = $field1['columns']['value']['column'];  $field2 = content_database_info(content_fields('yourfield2', 'yourtable'));  $table2 = $field2['table'];  $column2 = $field2['columns']['value']['column'];  if ($table1 == $table2) {    $sql = "SELECT n.*, t1.$column1, t1.$column2 FROM {node} n ";    $sql .= " INNER JOIN {$table1} t1 ON t1.nid = n.nid AND t1.vid = n.vid";  }  else {    $sql = "SELECT n.*, t1.$column1, t2.$column2 FROM {node} n ";    $sql .= " INNER JOIN {$table1} t1 ON t1.nid = n.nid AND t1.vid = n.vid";    $sql .= " INNER JOIN {$table2} t2 ON t2.nid = n.nid AND t2.vid = n.vid";  }  $sql .= " WHERE n.nid = %d";
  •  
    Important point: Using special functions to let CCK get the proper name of the field (allowing users to make CCK changes in the UI and let your code continue to work).
1 - 5 of 5
Showing 20 items per page