简体   繁体   English

在Drupal 7中关联不同的内容类型

[英]Relating different content types in Drupal 7

I've just started learning Drupal 7 and I'm stuck on a problem. 我刚刚开始学习Drupal 7,但遇到了问题。

I want to relate different content types using taxonomy. 我想使用分类法来关联不同的内容类型。 For example, how can I display blogs related to an article? 例如,如何显示与文章相关的博客? I know how to relate articles and basic pages but I don't know how can I relate blogs with articles? 我知道如何将文章和基本页面联系起来,但是我不知道如何将博客与文章联系起来?

Please help me. 请帮我。

Use reference field in blogs content type like 在博客内容类型中使用参考字段,例如

  • field name is: related with 字段名称是:与
  • field type is reference 字段类型是参考
  • set reference type node 设置引用类型节点
  • set node type is article 设置节点类型为文章
  • optional multivalued true 可选多值true

Now you have a relationship field in blogs 现在您在博客中有一个关系字段

Now you can do every thing with this relationship 现在,您可以通过这种关系做所有事情

Hope this make sense 希望这有意义

Thanks 谢谢

You would create your taxonomy vocabulary and supply it with terms. 您将创建分类词汇并为其提供术语。 On its own, this doesn't do anything, you need to add a field to each of your content types that are using this taxonomy. 单独执行此操作不会执行任何操作,您需要为使用此分类法的每种内容类型添加一个字段。

If you go back to your content types, structure > content type > article. 如果返回到内容类型,请单击结构>内容类型>文章。 Here you would create a new field of type term reference. 在这里,您将创建一个新的字段类型,术语引用。 Inside the settings of the field you'd select your vocabulary and then also the widget eg. 在字段的设置内,您将选择词汇表,然后再选择小部件,例如。 select list. 选择列表。 You can re-use this field on the other content types where you want to share this vocabulary. 您可以在要共享此词汇表的其他内容类型上重复使用此字段。

If you go back to your content for the types you added this field for and populate them with selections, when you view that page by default the term will appear as a link. 如果返回添加该字段所用类型的内容并用选择填充它们,则默认情况下,当您查看该页面时,该术语将显示为链接。 If you click this link it will take you to a page view that will list all the other nodes that have that term form that vocabulary. 如果单击此链接,将带您进入页面视图,该页面将列出具有该词汇表形式的所有其他节点。

More information on taxonomies: https://www.drupal.org/docs/7/organizing-content-with-taxonomies/about-taxonomies 有关分类法的更多信息: https : //www.drupal.org/docs/7/organizing-content-with-taxonomies/about-taxonomies

If you are creating a view and want to know how to pull in different tagged content there, I'd recommend reading this post which outlines the steps to do so https://drupal.stackexchange.com/questions/205921/how-do-i-show-related-content 如果您要创建视图,并且想知道如何在其中拉入不同的标记内容,建议您阅读这篇文章,其中概述了这样做的步骤https://drupal.stackexchange.com/questions/205921/how-do -i显示相关内容

The process: 过程:

Basic stages: 基本阶段:

 Create a “Content” view-block. Add a contextual filter: “Has taxonomy term ID”. Choose “provide a fixed value”. (From type): “Taxonomy term ID from URL“. 

Checking: 检查:

• Uncheck “Load default filter from the term page”. •取消选中“从术语页面加载默认过滤器”。 • Check “Load default filter from node page, that's good for related taxonomy blocks”. •选中“从节点页面加载默认过滤器,这对于相关的分类法块很有用”。

• Check “Limit terms by a vocabulary”. •选中“限制词汇量”。 • Check your desired vocabulary. •检查所需的词汇。

 Select “Filter to items that share any term”. Go down and check “Reduce duplicates”: This will several terms that relate to the same page – To appear. Only one will of them will. 

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

相关问题 标签部分在Drupal 8.1.1中的不同内容类型中具有不同的视图 - Tags section has different view in different content types in Drupal 8.1.1 将Drupal 6内容类型导入Drupal 7 - Import Drupal 6 content types into Drupal 7 Liferay中的Drupal内容类型 - Drupal Content Types in Liferay Drupal 6:Drupal Themer为不同类型的内容类型提供相同的候选名称 - Drupal 6: Drupal Themer gives same candidate name for different type of content types 在Drupal中即时创建内容类型 - Create content types on the fly in Drupal Drupal:数据库中的内容类型不在Structure> Content types中的内容类型列表中 - Drupal: Content type in database not in the list of content types in Structure>Content types Drupal 7:根据内容类型过滤内容 - Drupal 7 : Filter Content based on Content types Drupal:列出内容类型和内容计数 - Drupal: listing content types with content count 如何在Drupal视图中设置适用于两种不同内容类型的过滤器? - How do I set up filters in a Drupal view that apply across two different content types? Drupal 7“新建节点创建”是否启动/准备用于不同内容类型的字段? - Drupal 7 Does “New Node Creation” initiate/prepare the Fields for different Content Types?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM