function taxonomy_get_children in Drupal 6
Same name and namespace in other branches
- 4 modules/taxonomy.module \taxonomy_get_children()
- 5 modules/taxonomy/taxonomy.module \taxonomy_get_children()
- 7 modules/taxonomy/taxonomy.module \taxonomy_get_children()
Find all children of a term ID.
1 call to taxonomy_get_children()
- taxonomy_del_term in modules/
taxonomy/ taxonomy.module - Delete a term.
File
- modules/
taxonomy/ taxonomy.module, line 812 - Enables the organization of content into categories.
Code
function taxonomy_get_children($tid, $vid = 0, $key = 'tid') {
if ($vid) {
$result = db_query(db_rewrite_sql('SELECT t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.tid = t.tid WHERE t.vid = %d AND h.parent = %d ORDER BY weight, name', 't', 'tid'), $vid, $tid);
}
else {
$result = db_query(db_rewrite_sql('SELECT t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.tid = t.tid WHERE parent = %d ORDER BY weight, name', 't', 'tid'), $tid);
}
$children = array();
while ($term = db_fetch_object($result)) {
$children[$term->{$key}] = $term;
}
return $children;
}