【问题标题】:Orchard CMS Placement by field nameOrchard CMS 按字段名称放置
【发布时间】:2015-11-13 15:08:43
【问题描述】:

当涉及到专业问题时,文档是如此无用。 假设我有一个包含多个字段的 contentPart(例如 Fields_Common_Text)。现在假设我有一个name 字段和一个email 字段(这些只是示例,实际情况可能更复杂。

还假设我的部分有另一个字符串字段,我们称之为title。所以

CustomContentPart:
    Fields_Common_Text name
    Fields_Common_Text email
    this.As<TitlePart>().Title

现在真正的问题从这里开始。如何使用placement.info 文件将标题放在这两者之间。因为我可以做到以下几点:

<Place Parts_CustomContent="Content:0" />
<Place Fields_Common_Text="Content:1"/>

但这会将两个文本字段放在标题之后。如何按名称放置字段? (或者以任何其他方式,使用替代品不起作用,因为替代品是形状和渲染区域的层次,因此这些属性不能从父形状访问(以干净的方式))

【问题讨论】:

    标签: javascript c# .net content-management-system orchardcms


    【解决方案1】:

    我确实设法解决了这个问题

    解决方案正是我怀疑的方式。现在让我们假设我的 CustomPart 的形状也在其中呈现标题(因此实际的 TitlePart 被放置在其他地方并呈现在 Header 区域中) 所以有三种形状:

    Parts_CustomContent
    Fields_Common_Text 
    Fields_Common_Text
    

    现在为了将它们按name 文本字段、CustomContentPart 和email 文本字段的顺序放置在内容中,请将以下内容添加到您的placement.info 文件中:

    <Place Fields_Common_Text-name="Content:0"/>
    <Place Parts_CustomContent="Content:1" />
    <Place Fields_Common_Text-email="Content:"/>
    

    注意:记住name 和email 是您分配给TextFields 的正式名称(通过gui 或迁移)。当然大写的Name 和Email 是更好的名字,我只是想与问题主体保持一致。

    仅特定的 ContentType

    我尝试使用内容类型签名以及字段名称,但它不起作用。如果您只想将该展示位置应用于某些必须使用的内容类型:

    <Math ContentType='YourDesiredContentType'>
        <!-- Your Place tags -->
    </Match>
    

    【讨论】:

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