function taxonomy_node_get_terms_by_vocabulary in Drupal 4
Same name and namespace in other branches
- 5 modules/taxonomy/taxonomy.module \taxonomy_node_get_terms_by_vocabulary()
- 6 modules/taxonomy/taxonomy.module \taxonomy_node_get_terms_by_vocabulary()
Find all terms associated to the given node, within one vocabulary.
1 call to taxonomy_node_get_terms_by_vocabulary()
- forum_form in modules/
forum.module - Implementation of hook_form().
File
- modules/
taxonomy.module, line 671 - Enables the organization of content into categories.
Code
function taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = 'tid') {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight', 't', 'tid'), $vid, $nid);
$terms = array();
while ($term = db_fetch_object($result)) {
$terms[$term->{$key}] = $term;
}
return $terms;
}