开发者

how can i get term id of a page in drupal?

if i am browsing a page of taxonomy in drupal, is there a way to get term-id of this page??

ex:

 
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; 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜