creates programmatically a taxonomy in drupal 6
I am new to drupal, I need to create in my .install custom module file a taxonomy, and assign this taxonomy to a specific content type. Any idea how to do it ? Thanks !
I assume that with "create a taxonomy" you mean "create a taxonomy vocabulary". If this is the case, you need to populate an array such as: $vocabulary = array( 'name' => t('<VOCABULARY_NAME>'), 'multiple' => 0, // or 1, if you need multiple terms associated to any single node 'required' => 0, // or 1, if the association is required 'hierarchy' => 1, // or 0, if is a tag-like term 'relations' => 0, 'module' => '<YOUR_MODULE_NAME>', 'weight' => 0, 'nodes' => array('<YOUR_NODE_TYPE>' => 1), ); and save the vocabulary by issuing ** EDIT ** $ret = taxonomy_save_vocabulary($vocabulary); If $ret == 1 you have correctly saved your vocabulary and $vocabulary['vid'] will have the vid of the newly created vocabulary. If you want to add terms to it, you create arrays: $term = array( 'vid' => <VOCABULARY_VID>, 'name' => "<TERM NAME>", 'description' => "An optional description for the term", 'weight' => <AN_INTEGER_OPTIONAL_VALUE_FOR_WEIGHT>, ); $ret = taxonomy_save_term($term); and again $ret will be set to a status value of your save operation and $term['tid'] will be the term id of the new term.
Limit the contents shared by the author
How to theme exposed filter items in views - drupal 6
How to validate the input of views exposed form in drupal-6
Is it possible to use a story's title as a pager in views slideshow?
Force password change on email activation
Drupal 6 next tid value
subscription to news letter in drupal
IP to country in counter report in drupal
Image and video gallery on drupal website
How to add php files in drupal modules
Drupal - Computed Fields - Taxonomy Term Weight?
Automatically update drupal nodes at submit time
Privatemsg & send email notify on new message drupal6
How to create template file for skinr module in drupal?
Drupal 6 managing Content Profile profiles
strange content type in drupal