Drupal:如何构建分类菜单树

发布于 2024-09-25 17:35:07 字数 644 浏览 11 评论 0原文

我需要根据分类术语构建自定义菜单结构。问题是只有第一级应该是分类术语。所有嵌套项都必须是一个节点。每个节点只能有一个 Term。没有任何关联节点的术语不应出现在菜单中。

我怎么能这么做呢?对我有什么建议吗?

示例菜单:

TERM-1
    Node-1
    Node-2
    Node-3

TERM-2
    Node-1
    Node-2

...

谢谢。

编辑 我需要这个作为摄影师网站。每个术语都是一个全局类别,例如肖像艺术家。类别只是画廊的包装。根据上面的示例菜单,可能的结构可能如下所示:

Series (Term)
    Bodies (Node:Type->Gallery associated with Term:Series)
    Classic Cars (Node:Type->Gallery associated with Term:Series)
    Surroundings (Node:Type->Gallery associated with Term:Series)

I need to build a custom menu structure based on taxonomy terms. The Problem is that only the first level should be a Taxonomy-Term. All nested items must be a node. Each node can have only one Term. And Terms without any nodes associated should not appear in the menu.

How could i do that? Any suggestions for me?

Example Menu:

TERM-1
    Node-1
    Node-2
    Node-3

TERM-2
    Node-1
    Node-2

...

Thank you.

Edit
I need this for a photgrapher website. Each term is a global categorie like Portraits, or Artists. Categories are only a wrapper for galleries. Based on the example Menu above a possible structure could be something like this:

Series (Term)
    Bodies (Node:Type->Gallery associated with Term:Series)
    Classic Cars (Node:Type->Gallery associated with Term:Series)
    Surroundings (Node:Type->Gallery associated with Term:Series)

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

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

发布评论

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

评论(2

软的没边 2024-10-02 17:35:07

我建议带着观点这样做。您将需要创建一个列出节点的视图,并将该视图设置为按分类术语分组。

因此,创建一个新视图 (admin/build/views/add)

  • 视图类型:节点 - 为视图命名,然后继续下一页。
  • 过滤器
    • 节点:已发布 - 是
    • 节点:类型 - 图库
    • [可选]分类法:词汇 = 系列 - 这将隐藏尚未分配给系列的画廊。
  • 字段 - 添加字段时删除字段标签
    • 分类法:所有术语 - 您也可以使用分类法:术语,但如果您有多个分类法,例如免费标签,那么这些免费标签也会显示,因此所有术语更好,因为您可以限制词汇。
      • 选中复选框 - 从显示中排除
      • 按词汇表限制术语 - 系列
    • 节点:标题
      • 选中复选框 - 将此字段链接到其节点
  • 基本设置
    • 样式:未格式化
      • 单击齿轮更改设置并将分组字段设置为分类:术语
    • 要显示的项目:0 - 由于您不需要寻呼机,因此您可能希望显示所有结果。
  • 排序标准 - 您将添加两个排序标准...
    • 分类:权重 - 这控制组的顺序 - 您必须在分类管理区域中设置分类术语权重。 (如果您希望术语按字母顺序显示,您也可以按分类法:术语对其进行排序。)
    • 节点:标题 - 控制每个组中节点的顺序。

I would suggest doing this with a view. You will want to create a view which lists nodes, and set the view to group by taxonomy term.

So, create a new view (admin/build/views/add)

  • View Type: Node - name the view, and proceed to next page.
  • Filters
    • Node: Published - yes
    • Node: Type - Gallery
    • [optional] Taxonomy: Vocabulary = Series - this will hide galleries which have not been assigned to a Series.
  • Fields - delete the labels for fields as you add them
    • Taxonomy: All Terms - you could also use Taxonomy: Term, but if you have more than one taxonomy, such as free tagging, then those free tags would show up too, so All Terms is better because you can limit the vocab.
      • check the checkbox - Exclude from Display
      • limit terms by vocabulary - Series
    • Node: Title
      • check the checkbox - Link this field to its node
  • Basic Settings
    • Style: Unformatted
      • click on the cog to change settings and set Grouping Field to Taxonomy: Term
    • Items to Display : 0 - since you do not want a pager, you probably want to display all the results.
  • Sort Criteria - you will be adding two sort criteria...
    • Taxonomy: Weight - this controls the order for the groups - you will have to set your taxonomy term weights in the taxonomy administration area. (You could also just sort it by Taxonomy: Term if you want the terms to appear in alphabetical order.)
    • Node: Title - this controls the order for the nodes within each group.
你没皮卡萌 2024-10-02 17:35:07

分类菜单路径解决了这个问题。

Taxonomy menu trails solves this problem.

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