function taxonomy_node_get_terms_by_vocabulary
6.x taxonomy.module | taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid') |
Find all terms associated with the given node, within one vocabulary.
2 calls to taxonomy_node_get_terms_by_vocabulary()
- forum_form in drupal-6.x/
modules/ forum/ forum.module - Implementation of hook_form().
- forum_nodeapi in drupal-6.x/
modules/ forum/ forum.module - Implementation of hook_nodeapi().
File
- drupal-6.x/
modules/ taxonomy/ taxonomy.module, line 620 - Enables the organization of content into categories.
Code
function taxonomy_node_get_terms_by_vocabulary($node, $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.vid = %d ORDER BY weight', 't', 'tid'), $vid, $node->vid);
$terms = array();
while ($term = db_fetch_object($result)) {
$terms[$term->$key] = $term;
}
return $terms;
}