gpt4 book ai didi

plone - 金属:use-macro and metal:define-macro within Five ViewPageTemplateFile

转载 作者:行者123 更新时间:2023-12-04 13:52:26 25 4
gpt4 key购买 nike

我想在单个“五个ViewPageTemplateFile”页面模板中使用一个宏,以避免将代码粘贴到周围。

以下是我的尝试:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
tal:omit-tag=""
>

<metal:row define-macro="row">
<tal:block repeat="widget view/widgets">
<div tal:attributes="class python:'%s%s' % (widget.klass, widget.mode=='hidden' and ' hidden' or '')"
tal:condition="python:view._includeRow(widget.name)">

<div tal:replace="structure widget/render"></div>

</div>
</tal:block>
</metal:row>

<table class="datagridwidget-table-view" tal:attributes="data-extra view/extra">
<thead>
<tr>
<th class="header">
<!-- -->
</th>
<th id="" class="header" tal:condition="view/allow_insert"></th>
<th id="" class="header" tal:condition="view/allow_delete"></th>
<th id="" class="header" tal:condition="view/allow_reorder"></th>
<th id="" class="header" tal:condition="view/allow_reorder"></th>
</tr>
</thead>
<tbody class="datagridwidget-body" tal:attributes="data-name_prefix view/name_prefix; data-id_prefix view/id_prefix">
<tal:row repeat="widget view/getNormalRows">
<tr>
<metal:macro use-macro="here/row" />
</tr>
</tal:row>

<tal:row condition="view/getTTRow" define="widget view/getTTRow">
<tr>
<metal:macro use-macro="here/row" />
</tr>
</tal:row>


<tal:row condition="view/getAARow" define="widget view/getAARow">
<tr>
<metal:macro use-macro="here/row" />
</tr>
</tal:row>


</tbody>
</table>
<input type="hidden" tal:replace="structure view/counterMarker" />
</html>

但是,此处未定义 (据我所知,这是旧的独立页面模板的处理方式)。

如何从ViewPageTemplate .pt模板引用模板本身,并在.pt文件中使用/定义宏?

最佳答案

我想你要:

<metal:macro use-macro="template/macros/row" />

关于plone - 金属:use-macro and metal:define-macro within Five ViewPageTemplateFile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13165748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com