【问题标题】:How do I render an Archetypes in a template?如何在模板中呈现原型?
【发布时间】:2013-07-17 11:05:42
【问题描述】:

我想在自定义模板中呈现 Plone Archetypes 列表。

在我的示例中,我在目录中搜索“PortletPage”类型并获得 3 个项目。 然后我迭代这些项目,我想显示它们。

有没有办法做到这一点?

【问题讨论】:

  • 到目前为止您尝试过什么?例如,您对 Plone 使用的模板引擎了解多少?

标签: plone archetypes


【解决方案1】:

我建议查看 Plone 的 TAL 模板语言以及 portal_catalog 工具的文档。

以下是基于您所描述问题的快速示例:

<div tal:define="catalog context/portal_catalog;
                 results python:catalog.searchResults(portal_type='PortletPage');">

  <div tal:repeat="item results">
    <h3 tal:content="item/pretty_title_or_id" />
    <p tal:content="item/Description" />
  </div>

</div>

【讨论】:

    猜你喜欢
    • 2020-06-15
    • 2017-08-02
    • 2018-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-07
    • 2011-07-17
    相关资源
    最近更新 更多