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.
Hybridauth module social network icons not working with user/register page drupal 6
Is there a way to make an online customer tax exempt?
How to put two form elements in a row using Drupal Form API?
Increase memory_limit of subdomains in the plesk panel
Cart items missing after login, drupal6 with ubercart
How to disable “Read more” link in product description? (ubercart, drupal6)
How to configure site created in drupal on some other machine to be run on localhost of another machine
How to have different style files in multilingual website using Drupal 6?
scrollable views in drupal 6 is needed
hook_comment is not working for update operation in drupal
Drupal 6 - Image gallery image popup when navigating site?
How to put two cck fields in add content page in drupal 6
drupal block variable_set not saving select value
Drupal 6 Form “Radio” #return_value Not Working
Why am I getting a validation error?
Why Maximum Field Length in Views Module(drupal) doesnt changes the view?