开发者

Get term name by term id

开发者 https://www.devze.com 2023-03-06 12:23 出处:网络
I have a term product开发者_如何学Python with term id 123. How can I use the term id 123 to get the term name?http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function/taxonomy_get

I have a term product开发者_如何学Python with term id 123.

How can I use the term id 123 to get the term name?


http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function/taxonomy_get_term/5


place this function in template file

function getTermsName($taxnomyid){
$terms =  taxonomy_get_term($taxnomyid);
$termsname = $terms->name;
return $termsname;
}

and use <?php echo getTermsName($taxnomyid); ?> to print term name wherever you want $taxonomyid is your term id

0

精彩评论

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