install

Install Drupal modules programmatically

This is how you can install Drupal modules programmatically

<?php
function mymodule_install_features() {

   
$items = array();
   
drupal_install_modules(array( 'mymodule_cck', 'mymodule_views', 'mymodule_nodetypes'));
   
drupal_set_message("Installed features for Mymodule");
   
drupal_flush_all_caches();
    return
$items;
}
?>

And taxonomy

install_include(array('taxonomy'));
$props = array('module' => 'taxonomy', 'multiple' => 1);
install_taxonomy_add_vocabulary('Plants', array('article' => 'article'), $props);

$props = ar

How to add an Vocabulary in an install file

This is how you add an Vocabulary in an install file or in a module.

/**
* Install
*
**/
...
$vocab_count = db_query("SELECT COUNT(vid) AS vid_count FROM {vocabulary}
WHERE name = '%s'", 'A name');

$vocab_count = db_fetch_object($vocab_count);
$vocab_count = $vocab_count->vid_count;

if ($vocab_count == 0){
$vocab = array();

$vocab['name'] = 'A name';
$vocab['description'] = 'A description';
$vocab['help'] = 'Some help';
$vocab['multiple'] = 0;
$vocab['required'] = 1;
$vocab['module'] = 'zimplicit';
$vocab['no