_taxonomy_term_children
modules/taxonomy/taxonomy.module, строка 1100
- Версии
- 5 – 6
_taxonomy_term_children($tid)
Helper for taxonomy_term_count_nodes()
. Used to find out
which terms are children of a parent term.
Параметры
$tid
The parent term's ID
Возвращаемое значение
array
An array of term IDs representing the children of $tid
.
Results are statically cached.
Код
<?php
function _taxonomy_term_children($tid) {
static $children;
if (!isset($children)) {
$result = db_query('SELECT tid, parent FROM {term_hierarchy}');
while ($term = db_fetch_object($result)) {
$children[$term->parent][] = $term->tid;
}
}
return $children[$tid] ? $children[$tid] : array();
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии