Drupal 7 视图 - 按字段列出分组 [英] Drupal 7 Views - list group by field
问题描述
我有一个视图,它列出了 Bio
类型的内容(人物传记).但是,我想对其进行格式化,以便将它们分组到不同的标题下.
I have a View that list content of type Bio
(the biographies of people). However, I would like to format it so that they are grouped under different headings.
我向 Bios
内容类型添加了一个新字段,它是一个下拉列表,包含三个不同的选项 - Foo
、Bar
和 巴兹
.我想要做的是在他们各自组的标题下显示这些人.
I added a new field to the Bios
content type which is a dropdown list with three different options - Foo
, Bar
and Baz
. What I want to do is display the people under the heading of their respective group.
目前:
- John Doe
- Jane Doe
- Jack Doe
- Juanita Doe
- Jim Doe
我想要的:
#Foo
- John Doe
- Jane Doe
#Bar
- Jack Doe
- Juanita Doe
#Baz
- Jim Doe
推荐答案
您应该能够简单地在视图中进行分组.无需触摸模板.
You should be able to do the grouping simply within views. No need to touch the template.
以下是分组方法:
- 将下拉列表中的字段添加到视图中的字段列表中.如果您不想与每个人一起显示它(只想将其显示在顶部),请确保在设置字段时选择从显示中排除"
- 单击以配置视图格式的设置.我在示例中使用了未格式化列表",但这可以是 html 列表或表格...
- 选择您现在在视图中的字段(即使您没有显示它)作为分组字段!
应该是这样!让我们知道它是否适合您.
That should be it! Let us know if it works for you.
这篇关于Drupal 7 视图 - 按字段列出分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!