根据词汇不同的taxonomy_term视图(Drupal)
我正在使用taxonomy_term 视图来显示术语页面。问题是,taxonomy_term 视图在活动时用于每个术语页面。
我需要根据术语分配到的词汇表显示不同的术语页面。
如果我有词汇“1”,我只需要显示图像和标题,当我有词汇“2”时,我需要图像、标题和预告片。最后,当使用词汇“3”时,我需要与词汇 2 中相同的项目,但具有不同的排序标准。
有没有一种方法可以以相当简单的方式实现此目的,或者至少有一种方法可以对 2 个词汇表使用taxonomy_term 视图,并对其他词汇表使用常规术语页面?我在drupal.org上搜索了很多类似的问题,但通常答案是其他一些模块应该是用户的(例如面板),这相当复杂并且影响速度性能。这是一个有用的讨论,带有一个片段,但它对我不起作用:
I'm using taxonomy_term view to display term pages. The problem is that taxonomy_term view, when active, is used for every term page.
I need to display different term pages depending on the vocabulary that the term is assigned to.
If I have vocabulary "1", I need to display only image and title, when I have vocabulary "2" I need image, title and teaser. Finally, when using vocabulary "3", I need the same items as in vocab 2, but with different sort criteria.
Is there a way to accomplish this in a fairly simple way or at least a way to use taxonomy_term view for 2 vocabularies and use regular term pages for others? I searched on drupal.org, there are many similar questions, but usually the answer is that some other modules should be user (e.g. Panels), which is quite complicated and it affects speed performance. Here is a useful discussion, with a snippet, but it didn't work for me:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
分类视图集成器模块正是您所寻找的:http://drupal.org/project/tvi
The Taxonomy Views Integrator module is exactly what you're looking for: http://drupal.org/project/tvi
过滤器并选择分类:词汇
,然后选择您要创建此特定显示的词汇。更改字段
。这将为显示的每个分类页面创建不同的 URL。
如果您希望所有这些都具有相同的 url,则使用附件显示,然后将所有显示附加到基本页面。你就完成了:)
Filter and select Taxonomy: Vocabulary
and then choose the vocabulary for you are creating this particular display.Change the fields
accordingly in each of the display.This will create different URL for each of the taxonomy page of the display.
If you want all of them to have the same url then use attachment display and then attach all the displays to the basic page. And you are done :)
作为 Jared 的后续内容,该网站列出了一些通过代码执行此操作的方法:
http://www.appnovation.com/custom-taxonomy-term-pages
基本上,您使用
hook_menu_alter()
来查看词汇表名称,然后手动显示您选择的视图。在我看来,这对于 D7 来说是一个更好的选择,因为 TVI 的 D7 版本尚未准备好投入生产(根据模块页面)。
As a followup to Jared, this site lists some ways to do this via code:
http://www.appnovation.com/custom-taxonomy-term-pages
Basically, you're using
hook_menu_alter()
to look at the vocabulary name, then manually displaying a view of your choice.This is a better option for D7, in my opinion, since the D7 version of TVI is not ready for production (according to the module page).