查看与 Drupal 6 中的分类术语 A (AND) 术语 B 相关的文章
简介:
我目前正在致力于将 Drupal-6 定制为新闻门户。
总之,我正在尝试查看属于术语 5 和术语 1 的帖子。drupal
文档提到,这可以通过以下分类 URL 来实现,方法是用逗号 (,) 分隔术语 id:
http://drupal-server/taxonomy/term/5,1
< em>(请参阅使用词汇表进行导航:http://drupal.org/node/22273)
上面的内容没有按预期工作,并且显示的是“term 5 OR term 1”而不是“term 5 AND term 1”的内容。
关于如何解决这个问题有什么想法吗?
问题详细信息:
我定义了两个词汇表:
“内容”词汇表,其中包含以下术语:
a. 活动
b. 新闻
c. 讲座
“学院”词汇:
a. A大学
b. B大学
c. 大学C
每次发布文章时,都会为其指定一个术语,指示该文章与哪所大学相关,以及该文章是活动、新闻还是讲座。
我正在尝试显示类型为“讲座”和“大学 A”的帖子。
根据 Drupal 文档,这可以使用 URL 来实现:
/taxonomy/term/5,1
假设“University A”被分配术语 ID 5,“Lecture”被分配术语 id 1文档提到逗号分隔符 (,) 用作 AND 运算符,因此仅显示与术语 5 '和' 术语 1 相关的帖子。
不幸的是,这没有按预期工作,它向我显示与 相关的帖子。术语 5 或与术语 1 相关的帖子。
这是 Drupal 错误吗?关于如何强制执行 AND 有什么想法吗?我什至尝试用“+”运算符替换逗号,但没有成功(即/taxonomy/term/5+1)。
Summary:
I'm currently working on customizing Drupal-6 as a news portal.
In summary, I'm trying to view posts that belong to term 5 AND term 1.
The drupal documentation mentions that this can be achieved through the below taxonomy URL by separating the term ids with a comma (,):
http://drupal-server/taxonomy/term/5,1
(See. Using Vocabularies for Navigation: http://drupal.org/node/22273)
The above is not working as expected and is showing content with "term 5 OR term 1" instead of "term 5 AND term 1".
Any ideas on how to fix this?
Problem Details:
I have defined two vocabularies:
"Content" vocabulary which has the terms:
a. Events
b. News
c. Lectures
"Academy" vocabulary:
a. University A
b. University B
c. University C
Every time an article is posted, it is assigned a term indicating which university does it relate to, and whether it is an Event, News or Lecture.
I'm trying to display the posts that are of type "Lecture" AND "University A".
According to the Drupal documentation, this can be achieved using the URL:
/taxonomy/term/5,1
Assuming "University A" got assigned the term ID 5 and the "Lecture" got assigned term id 1. The documentation mentions that the comma separator (,) works as an AND operator and thus displaying only posts that relate to term 5 'and' term 1.
Unfortunately, this is not working as expected, it is showing me the posts that relate to term 5 OR posts that relate to term 1.
Is this a Drupal bug? Any ideas on how to force an AND? I've even tried replacing the comma with the "+" operator but with no luck (ie. /taxonomy/term/5+1).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我已经找到了答案:
首先,这是安装了视图模块的 Drupal 中已经存在的错误,您可以从此链接中看到:
ht tp://drupal.org/node/348360
所以,您必须选择解决此问题:
禁用视图模块中默认启用的taxonomy_term 视图。
从管理转到管理-->网站建设-->然后,视图向下滚动,直到找到taxonomy_term 视图,然后单击其旁边的禁用链接。
或者创建一个带有参数的视图。有关如何执行此操作的信息,请参阅以下链接:
http://gotdrupal.com/videos/drupal-views-arguments
Okay, I've got an answer for this:
First of all, this is a bug that already exists in Drupal with the Views Module installed as you can see from this link:
ht tp://drupal.org/node/348360
So, you have to choices to fix this problem:
Either disable the taxonomy_term view that is by default enabled in the views module.
From the administration go to Administer --> Site Building --> Views then scroll down till you find the taxonomy_term view and click on the Disable Link next to it.
Or create a view with arguments. See the following link for information on how to do that:
http://gotdrupal.com/videos/drupal-views-arguments