function taxonomy_get_related
6.x taxonomy.module | taxonomy_get_related($tid, $key = 'tid') |
Find all term objects related to a given term ID.
1 call to taxonomy_get_related()
- taxonomy_form_term in drupal-6.x/
modules/ taxonomy/ taxonomy.admin.inc - Form function for the term edit form.
File
- drupal-6.x/
modules/ taxonomy/ taxonomy.module, line 762 - Enables the organization of content into categories.
Code
function taxonomy_get_related($tid, $key = 'tid') {
if ($tid) {
$result = db_query('SELECT t.*, tid1, tid2 FROM {term_relation}, {term_data} t WHERE (t.tid = tid1 OR t.tid = tid2) AND (tid1 = %d OR tid2 = %d) AND t.tid != %d ORDER BY weight, name', $tid, $tid, $tid);
$related = array();
while ($term = db_fetch_object($result)) {
$related[$term->$key] = $term;
}
return $related;
}
else {
return array();
}
}