【问题标题】:ExpressionEngine – Creating a submenu with relationshipsExpressionEngine – 创建具有关系的子菜单
【发布时间】:2015-04-19 02:00:31
【问题描述】:

我正在使用 ExpressionEngine 为时尚品牌设计一个网站。他们每个季节都有系列,他们为每个系列做多个“项目”。例如艺术品、视频等。例如 Collection A 可能有 3 个项目,而 Collection B 可能有 2 个项目。

Collections
      - title (text input)
      - url_title (text input)
      - collection-year (text input)
      - season (select dropdown)
      - images (channel images)

Projects
      - title (text input)
      - url_title (text input)
      - project-collection (relationship to collection)
      - project-images (channel images)

关系似乎是将项目与集合联系起来的最佳方式。我正在努力为按集合分组的项目创建一个子菜单。比如……

Collection A
- Project 1A
- Project 2A
- Project 3A

Collection B
- Project 1B
- Project 2B

有什么想法吗?

谢谢!迈克尔

【问题讨论】:

    标签: templates expressionengine relationships


    【解决方案1】:

    来自 Robson Sobral 的回答

    如果在每个项目中您都必须选择它指向的集合,那么这些集合就会成为它们的子条目。

    在菜单上,按集合分组,您必须寻找 每个家长:

    {exp:channel:entries channel="colletions"}
    {title}
    {parents field="project-collection"}
         {parents:title}   
    {/parents} 
    {/exp:channel:entries} 
    

    向谁提交数据则完全相反:他们可以看到每个项目 作为集合的孩子。这就是为什么,从模板编码 透视,看起来有点混乱。

    这样想:之前必须提交的频道条目是 总是有关系字段的孩子和频道是 总是父母。因为集合必须在 项目,它们是子条目。

    https://expressionengine.stackexchange.com/questions/31096/relationships-how-to-filter-by-parent

    【讨论】:

      猜你喜欢
      • 2012-05-02
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 2013-09-03
      • 2014-11-09
      • 1970-01-01
      • 2013-05-02
      • 1970-01-01
      相关资源
      最近更新 更多