taxonomy_get_children
Definition
taxonomy_get_children($tid, $vid = 0, $key = 'tid')
modules/taxonomy.module, line 570
Description
Find all children of a term ID.
Code
<?php
function taxonomy_get_children($tid, $vid = 0, $key = 'tid') {
if ($vid) {
$result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE t.vid = %d AND h.tid = t.tid AND h.parent = %d ORDER BY weight, name', $vid, $tid);
}
else {
$result = db_query('SELECT t.* FROM {term_hierarchy} h, {term_data} t WHERE h.tid = t.tid AND parent = %d ORDER BY weight', $tid);
}
$children = array();
while ($term = db_fetch_object($result)) {
$children[$term->$key] = $term;
}
return $children;
}
?> 