| 5 taxonomy.module | taxonomy_get_parents($tid, $key = 'tid') |
| 6 taxonomy.module | taxonomy_get_parents($tid, |
| 7 taxonomy.module | taxonomy_get_parents($tid) |
Find all parents of a given term ID.
5 calls to taxonomy_get_parents()
File
- modules/
taxonomy.module, line 814 - Enables the organization of content into categories.
Code
function taxonomy_get_parents($tid, $key = 'tid') {
if ($tid) {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON h.parent = t.tid WHERE h.tid = %d ORDER BY weight, name', 't', 'tid'), $tid);
$parents = array();
while ($parent = db_fetch_object($result)) {
$parents[$parent->$key] = $parent;
}
return $parents;
}
else {
return array();
}
}
Login or register to post comments