如何根据提取到附加视图中的内容从默认 Drupal 视图中过滤掉内容?

发布于 2024-09-26 06:25:23 字数 278 浏览 2 评论 0原文

目前:

我有一个页面视图,通过简单的 CCK 下拉菜单显示标记为“未推荐”的所有内容。

视图的附件显示所有“特色”内容,并且样式设置得更令人印象深刻。

希望能够做的是在附加视图的顶部显示一些(例如3个)特色项目,并显示所有内容,无论是否在下面的视图中展示, 不包括附件中显示的 3 个。

使用 Views UI 以及可能需要的一两个自定义模块来实现此目的最简单的方法是什么?

我正在使用 Drupal 6 和 Views 2

currently:

i have a page view that is displaying all content that is flagged as "not featured" with a simple CCK dropdown.

the attachment to the view displays all content that is "featured" and is styled to be a little more impressive.

what i'd like to be able to do is have a few, say 3, featured items display at the top in the attached view, and display all content, whether featured or not in the view below, excluding the 3 displayed in the attachment.

what would be the simplest way to achieve this using the Views UI and perhaps a custom module or two if neccessary?

i'm using Drupal 6 and Views 2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぃ弥猫深巷。 2024-10-03 06:25:23

有多种方法可以做到这一点。以下是一些替代方案

  1. (使用您的方法)我的理解是您正在使用状态为“精选”的 CCK 选择列表字段(我们将其称为 FState)。本质上,您需要显示附件显示中显示的项目以及页面视图中未显示的项目。
    • 在附件视图中,您应该添加一个过滤器,其内容为Content: FState = Featuresed。您可以通过在“视图”过滤器下拉列表中选择“内容”组来执行此操作。选择内容:FState (field_fstate) - 允许的值。选择精选。确保运算符是是其中之一
    • 在页面视图中执行完全相同的操作,除了确保运算符是 is none of
  2. 如果我自己这样做,我会使用用于特色内容的 nodequeue 模块 ( http://drupal.org/project/nodequeue )。对于我的附件视图,我将确保项目位于节点队列中,对于页面视图,我将确保项目不在节点队列中(使用正确的过滤器)。互联网上有大量关于使用 NodeQueue 并将其与视图集成的材料。
  3. 另一种选择是使用标志模块( http://drupal.org/project/flag ),尽管我怀疑 Nodequeue 会更适合你。

编辑:
根据您的评论,我更好地了解您的要求。也许您将一些语言混合在一起,这可能会让外行人感到困惑。当您说“特色”内容时,这意味着该内容是专门显示的。因此,当您说“特色”内容也与非特色内容一起出现在页面视图中时,这可能会令人困惑。

无论如何,总而言之,我明白您现在的要求是什么(继续按照您的意思使用“特色”)

  1. 您有两种观点: 附件
    视图和页面视图。附件
    视野有点多
    吸引人的。
  2. 附件视图中出现的新闻文章未出现
    在页面视图上
  3. 假设附件视图有容纳 4 篇文章的空间,
  4. 有时您会将文章标记为“精选”。最新4篇文章
    那些“特色”出现在
    附件视图。在页面视图上,
    所有新闻文章也显示在
    按时间顺序排列,不考虑
    它们是否被标记为
    “特色”或过去没有。唯一的条件
    是不应该有
    附件之间重复
    视图和页面视图。

您的规格中有一点疑问......暂时忘记您的 CCK 选择字段。我的问题是:您是否想要 (a) 在附件视图中按时间顺序简单显示 4 篇最新“精选”文章,或者 (b) 您是否想要明确确定项目及其顺序附件视图?

在情况 (b) 中,您可以选择一篇可能 1 个月前的文章,因为它是一篇精彩的文章,而且您仍然想继续展示它。在(a)中你没有这种灵活性。随着新的“特色”文章的制作,旧的文章会从附件视图中移出。

当然对于情况(a) & (b) 附件视图中显示的文章不会出现在页面视图中(这应该始终成立)。

对于情况 (a),您应该对附件视图使用 Nodequeue 模块;对于情况 (b),您可以继续使用 CCK 选择列表方法来提取特色文章,就像您当前对附件视图所做的那样。要防止页面视图中出现重复项,请使用 http://drupal.org/project/views_unique 或 < a href="http://drupal.org/project/views_exclude_previous" rel="nofollow">http://drupal.org/project/views_exclude_previous 模块

There are multiple ways of doing this. Here are some alternatives

  1. (Using your approach) My understanding is that you are using a CCK Select list field (lets called it FState) which has a state "Featured". Essentially you need to show items that are featured in the attachment display and show items that are not featured in the page view.
    • In the attachment view you should add a filter which will be Content: FState = Featured. You can do this by choosing the Content group in the Views filter drop down. Choose Content: FState (field_fstate) - Allowed values. Select Featured. Make sure the operator is is one of
    • In the page view do exactly the same thing except make sure the operator is is none of
  2. If I were to do this myself I would use a nodequeue module ( http://drupal.org/project/nodequeue ) for featured content. For my attachment view I would ensure that the items were in the nodequeue and for the page view I would ensure that the items were NOT in the nodequeue (using the correct filter). There is plenty of material available on the internet on using nodequeue and integrating them with views.
  3. Another alternative is to use the Flag Module ( http://drupal.org/project/flag ) though I suspect nodequeue will be a better match for you.

Edit:
Based on your comments I understand your requirements better. Perhaps you are mixing some language together that can be potentially confusing to an outsider. When you say "featured" content, that means that the content is shown specially. So it is confusing, perhaps, when you say that "featured" content also appears in the page view along with unfeatured content.

Anyways in summary here is what I understand what your requirement is now (continuing to use "featured" in the way you mean it)

  1. You have two views: An attachment
    view and a Page View. The attachment
    view is a little bit more
    attractive.
  2. A news article that appears on the attachment view does NOT appear
    on the page view
  3. Lets say the attachment view has space for 4 articles
  4. Occasionally you mark articles as "featured". The 4 latest articles
    that are "featured" appear in the
    attachment view. On the page view,
    all news articles are also shown in
    chronological order regardless of
    whether they had been marked as
    "featured" or not in the past. The only condition
    is that there should be no
    repetition between the attachment
    view and page view.

There is a slight doubt in your specification....forget about your CCK select field for a second. My question is: Do you want to (a) Simply show the 4 latest "featured" articles in chronological order in the attachment view or (b) Do you want to explicitly determine the items and their order in the attachment view?

In case (b) you can have the luxury of choosing an article that was perhaps 1 month old because it was a spectacular article and you still want to keep showing it. In (a) you don't have that flexibility. As new "featured" articles are made, the old ones move out from the attachment view.

Of course for cases (a) & (b) the articles that are shown in the attachment view will not appear in the page view (this should always holds true).

For case (a) you should use nodequeue module for the attachment view and for case (b) you can continue using the CCK Select list method to pull out featured articles as you do currently for the attachment view. To prevent duplicates appearing in the page view use the http://drupal.org/project/views_unique or http://drupal.org/project/views_exclude_previous modules

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文