how can i get term id of a page in drupal?
select * from term_data limit 2; +-----+-----+--------------------------+-------------+--------+----------+------+ | tid | vid | name | description | weight | language | trid | +-----+-----+--------------------------+-------------+--------+----------+------+ | 24 | 1 | Central African Republic | | 0 | en | 0 | | 26 | 1 | Cyprus | | 0 | en | 开发者_Python百科 0 | +-----+-----+--------------------------+-------------+--------+----------+------+
if i browse the page of Cyprus, how can i get its tid??
Thanks...
i got the answer, it is arg(2)
- arg(0) ==> returns "taxonomy"
- arg(1) ==> returns "term"
- arg(2) ==> returns tid
in other words
if (arg(0) == 'taxonomy' && is_numeric(arg(2))) {
return arg(2);
}
else
return FALSE;
}
精彩评论