Drupal Views..如何组合重复值然后显示具有该值的节点?

发布于 2024-12-13 17:22:37 字数 125 浏览 3 评论 0原文

我有一个网站,学生可以在上面发布自己的内容。每当他们创建内容时,都会要求他们输入学校名称。由于同一所学校有多名学生,我想合并“学校名称”字段的所有重复值。我还想链接每个学校名称,以便它仅显示所选学校的内容。这可能吗?如果是这样,怎么办?

I have a site where students can post their own content on it. Whenever they create content they are asked to type in their School Name. Since there will be multiple students from the same school I want to combine all of the duplicate values for the School Name field. I also want to link each School Name so it displays content from only the selected School. Is this possible? If so, how?

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

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

发布评论

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

评论(2

伴梦长久 2024-12-20 17:22:37

您确实应该考虑将 school_name 变量用于分类词汇表(http://drupal.org/node/23405),这样,该字段就不会重复,因为它引用了词汇表中的相同术语。

然后,在创建内容类型(或用户)字段时,使用“与分类法的关系”字段选项。

由于您似乎不知道所有可能的学校,因此请使用标签小部件。

无论如何,您应该考虑重复数据删除,因为这种内置方法不考虑同一学校名称的拼写错误或不同拼写。 (尽管标签字段具有自动完成功能)。

更好的方法是向用户展示所有可能的学校,但是,这意味着您需要了解所有可能的学校。

[编辑]这当然表明您正在使用 drupal7(或更高版本)。如果没有,请使用 cck 代替。

you really should consider using the school_name variable for a taxonomy vocabulary (http://drupal.org/node/23405), this way, the field wont be a duplicate, because it references the same term in the vocabulary.

then, when creating the content-type (or user) fields, use the 'relation to taxonomy' field option.

since it seems like you do not know all possible schools, use the tag widget.

in any case, you should think about deduplication, since this builtin method is not considering misspellings or different spellings of the same school name. (although the tag field has a autocomplete function).

a better approach is to present the user with all possible schools, however, that means you need to know all possible schools..

[EDIT] this, of course, is suggesting you are using drupal7 (or later). if not, use cck instead.

晨曦慕雪 2024-12-20 17:22:37

从标签来看,情况似乎是Drupal-6。

我认为,为了让您获得真正好的建议,我们需要更多有关该项目范围以及将覆盖多少所学校的信息。如果您谈论的是全球或美国范围内的范围,则有许多学校具有相同的名称,因此您可能需要学校名称/城市组合(或其他内容)才能为学校提供唯一标识符。我建议您通过某种方式从预设列表中进行选择,无论该项目仅覆盖一个小学区,还是有数千所学校,这样您就不会遇到在内容创建过程中创建重复“学校”的问题。

由于分类术语在 Drupal 6 中不是可字段实体,因此您可能需要考虑为学校创建一个单独的内容类型(这将允许您包含位置信息等),并且当学生输入标识的内容时,该内容类型将表示为节点引用一所学校。在 Drupal 7 中,词汇表应该适用于“学校”,因为您可以添加字段,但您可能希望使用某些模块,这些模块与节点(内容类型)一起使用比与可字段实体一起使用效果更好(例如添加位置)数据或词汇表的其他字段)。

From the tags, it seems the situation is Drupal-6.

I think for you to get really good advice, we would need more information about the scope of the project and how many schools would be covered. If you are talking about a worldwide or US-wide scope, there are many schools with the same name, so you might need a school name / City combination (or something) to have a unique identifier for a school. I would suggest you have some way of selecting from a preset list, whether the project covers just a small school district, or there are thousands of schools, that way you won't have issues with duplicate "schools" created during the content creation process.

Since taxonomy terms are not fieldable entities in Drupal 6, you might want to consider creating a separate content type for schools (which would allow you to include location information, etc) and which would be represented as a node reference when students enter content that identifies a school. In Drupal 7, a vocabulary should work for the "school", since you can add fields, but there might be modules that you'd want to use which work better with nodes (a content type) than with fieldable entities (e.g. adding location data or other fields to a vocabulary).

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