以下代码对我有用(在删除标签的show-this-page="1"
属性之后sethtmlpageheader
)(它是树枝模板中的一个片段(category
变量从父模板传递给模板),但我想它应该在其他模板引擎或香草html也是):
{% set htmlPageHeaderName = "product-list-header-" ~ category.guid %}
<htmlpageheader name="{{ htmlPageHeaderName }}"> {# mPdf reserved tag #}
<div class="product-list-header">
<b>{{ macros.categoryHeadingWithParentsToLvl(category, "div", 0) }}</b></div>
</htmlpageheader>
<htmlpagefooter name="product-list-footer"> {# mPdf reserved tag #}
<div class="product-list-footer">
tel: <b>123 456 789</b>, fax: <b>123 456 788</b>, e-mail: <b>info@info.info</b>, web:<b>http://www.www.ww</b>
</div>
<div class="page-no">{PAGENO}</div>
</htmlpagefooter>
<sethtmlpageheader name="{{ htmlPageHeaderName }}" page="all" value="1" /> {# mPdf reserved tag #}
<sethtmlpagefooter name="product-list-footer" page="all" value="1"/> {# mPdf reserved tag #}
<columns column-count="2" valign="justify" column-gap="8"> {# mPdf reserved tag #}
{% set categoryParents = category.parentsToLvl(1) %}
{{ macros.categoryHeadingWithParentsToLvl(category, "h2", 1) }}
<div class="productsList">
{% for producerName, productsByEdition in productsByCategoryProducerEdition %}
<div class="producerDiv">
<h3>{{ producerName }}</h3>
{% for editionName, products in productsByEdition %}
<div class="editionDiv">
...