| 1 |
<?php |
<?php |
| 2 |
// $Id: $ |
// $Id: taxonomy_breadcrumb.inc,v 1.1.2.2 2009/04/24 02:51:41 mgn Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 51 |
*/ |
*/ |
| 52 |
function _taxonomy_breadcrumb_node_get_lightest_term($nid) { |
function _taxonomy_breadcrumb_node_get_lightest_term($nid) { |
| 53 |
|
|
| 54 |
/* We only want the first row of the result--this is the lightest term of the |
// We only want the first row of the result. This is the lightest term of the |
| 55 |
* lightest vocab. This query should be the same as the query found in |
// lightest vocab. |
| 56 |
* taxonomy_node_get_terms. |
$result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {term_hierarchy} h ON t.tid = h.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, h.parent DESC, t.weight, t.name', 't', 'tid'), $nid); |
| 57 |
*/ |
|
|
$result = db_query(db_rewrite_sql('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name', 't', 'tid'), $nid); |
|
| 58 |
// Extract the first row of query. |
// Extract the first row of query. |
| 59 |
$term = db_fetch_object($result); |
$term = db_fetch_object($result); |
| 60 |
|
|
| 61 |
return $term; |
return $term; |
| 62 |
} |
} |
| 63 |
|
|