简体   繁体   English

在分类页面上的Drupal视图内打印分类术语

[英]Print Taxonomy Term inside Drupal View on Taxonomy Page

I have a taxonomy of 'Market' and on that taxonomy's page, I am using a view. 我有一个“市场”的分类法,并且在该分类法的页面上,我使用的是视图。 Inside that view, I would like a heading that prints out the taxonomy of the page but I cannot figure out how to access the taxonomy term inside the Views tempate. 在该视图内部,我想要一个打印页面分类法的标题,但是我无法弄清楚如何在“视图”模板中访问分类法术语。

In View template you get Taxonomy page data through arguments. 在“视图”模板中,您可以通过参数获取“分类法”页面数据。

if(arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))){
  $term_id = arg(2); // Your Term Id
  // if you fetch more data then load the taxonomy
  $term_obj = taxonomy_term_load($term_id);
  print "<pre>";
  print_r($term_obj);
  print "</pre>";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM