简体   繁体   English

Drupal - 禁用分类术语页面上的节点列表?

[英]Drupal - Disable listing of nodes on taxonomy term page?

Is it possible to disable the normal taxonomy listing of nodes on taxonomy term pages? 是否可以禁用分类术语页面上的节点的正常分类列表?

The reason I need this is I want to use a view's override of taxonomy pages BUT the default views override stops a breadcrumb module working properly. 我需要这个的原因是我想使用视图覆盖分类页面但是默认视图覆盖会阻止面包屑模块​​正常工作。 So, I want to make a term view but as a block and show it on certain pages with PHP. 所以,我想创建一个术语视图,但作为一个块,并在PHP的某些页面上显示它。

Thanks 谢谢

This module claims to do just what you are seeking, but it did not seem to work despite checking the correct taxonomy to disable: 该模块声称只是按照您的要求进行操作,但尽管检查了正确的分类以禁用它,但它似乎无法工作:

http://drupal.org/project/disable_term_node_listings http://drupal.org/project/disable_term_node_listings

But putting the following in your theme's template.php will suppress those node listings: 但是将以下内容放在主题的template.php中会抑制这些节点列表:

function MY_THEME_preprocess_page(&$variables) {
  if(arg(0) == "taxonomy" && arg(1) == "term") {
    $variables['page']['content']['system_main']['nodes'] = null;
  }
}

It's sort of a dirty way to do it, and you'll have to hide the pager using CSS, but it works. 这是一种肮脏的方式,你必须使用CSS隐藏寻呼机,但它的工作原理。

Another way of doing this is using the Display Suite and Taxonomy Display module. 另一种方法是使用Display SuiteTaxonomy Display模块。 Install them, then go to admin/structure/taxonomy/[mytaxonomy]/display . 安装它们,然后转到admin / structure / taxonomy / [mytaxonomy] / display

Under "Use custom display settings for the following view modes" select "Taxonomy term page". 在“使用以下视图模式的自定义显示设置”下,选择“分类术语页面”。

Then, in the "Taxonomy term page" view mode, under Term page display, select "Associated content display": HIDDEN. 然后,在“分类术语页面”视图模式下,在术语页面显示下,选择“关联内容显示”:HIDDEN。

Done! 完成! :) :)

This probably isn't the cleanest way but I've made a page-taxonomy.tpl.php and removed this: <?php print $content; ?> 这可能不是最干净的方式,但我已经制作了一个page-taxonomy.tpl.php并删除了这个: <?php print $content; ?> <?php print $content; ?> So far it seems this solution will work for my site, but I'd still like to know the proper way to do it. <?php print $content; ?>到目前为止,似乎这个解决方案会为我的网站工作,但我仍想知道正确的方式去做。

这是一个绝对的NO ,你不能删除$content因为还有其他模块依赖于这个变量,例如meta,你剥离了这个分类页面的SE O.

If all you want to do is override the taxonomy term pages with a View, but NOT use the default view, you could create a custom module implementing hook_menu() or you could also take a look at the Taxonomy Redirect module . 如果您要做的只是使用View覆盖分类术语页面,但不使用默认视图,您可以创建实现hook_menu()的自定义模块,或者您也可以查看Taxonomy Redirect模块

From the Taxonomy Redirect page: 从Taxonomy Redirect页面:

This module allows the administrator to change the destination of Taxonomy Term links. 此模块允许管理员更改Taxonomy Term链接的目标。

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

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