vocabulary

Get term from modules vocabulary

<?php
function atrium_opportunity_get_term($value="New", $voc = "features_opportunity_state"){

 
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s';", $voc));

 
$term = db_fetch_array(db_query('SELECT tid FROM {term_data} WHERE name LIKE "%s" AND vid = %d', $value, $vid));

  return array(
$vid => array($term['tid'] => $term['tid']));
}
?>

Drupal taxonomy term function


/**
* Get for l_keywords from vocabulary to
* dropbox in widget
*
*/
function _get_l_keywords() {

$vid = cdt_keywordlink_get_vocabulary();
$pole = array();
$items = array();
$terms = taxonomy_get_tree($vid);

if($result = db_query('SELECT * FROM {term_data} WHERE vid = %d', $vid)) {

while ($data = db_fetch_object($result)) {
$matches[$data->tid] = check_plain($data->name);
}
}

if (count($matches) > 0) {
return $matches;
}else{
drupal_set_message("There is no l_keywords registered in the cdt_keywordlink vocabu