function nodewords_get_term in Nodewords: D6 Meta Tags 6
Same name and namespace in other branches
- 6.3 nodewords.module \nodewords_get_term()
- 6.2 nodewords.module \nodewords_get_term()
Return the term object matching a term ID. This is a modified version of taxonomy_get_term() which uses db_rewrite_sql().
Parameters
$tid: A term's ID.
$uid: The user ID; if not passed, the function will use the global user ID.
Return value
A term object, or FALSE. Results are statically cached.
File
- ./
nodewords.module, line 917 - Implement an API that other modules can use to implement meta tags.
Code
function nodewords_get_term($tid, $uid = NULL) {
global $user;
static $terms = array();
if (!isset($uid)) {
$uid = $user->uid;
}
if (!isset($terms[$uid][$tid])) {
$terms[$uid][$tid] = db_fetch_object(db_query(db_rewrite_sql('SELECT * FROM {term_data} t WHERE t.tid = %d', 't', 'tid'), $tid));
}
return !empty($terms[$uid][$tid]) ? $terms[$uid][$tid] : FALSE;
}