OctoberCMS DynamicPDF动态标题内容文本

问题描述 投票:0回答:1

我正在使用OctoberCMS DynamicPDF插件,它根据我的要求工作得非常好。

但是,我有动态PDF标题文本内容,我试图覆盖我的标题内容,但它无法正常工作。这是我到目前为止所尝试的。

模板文件

{% set headerTExt = 'asdf' %}

布局文件

 <html>
        <head>
            <style type="text/css" media="screen">
                {{ css|raw }}
            </style>
            <title>Regency Brochure</title>
        </head>

        <div id="header">
             <div style="display: inline-block; position: absolute; left: 2.5%; top: 12px;">
                <img src="{{  logo }}" style="width: 60px; height:auto; margin-top:5px;"/> 
             </div>
             <div style="text-align: right; font-size: 20px; color: #b49132; text-transform: uppercase; font-family: 'Montserrat-Bold'; position: absolute; right: 3.5%; top: 25px;">
{{ headerTExt }}
</div>
          </div>
          <div id="footer">
             <div class="footerText">www.regencycorporate.com.au</div>
          </div>




            {{ content_html|raw }}

    </html>

布局文件CSS

@page { margin:25mm 0px 8mm 0px;}
         header { position: fixed; left: 0px; top:-25mm; right: 0px; height: 22mm;   background-color: #fff;   border-bottom: solid 1px #d8d8d8;}
         footer { position: fixed; left: 0px; bottom:-8mm; right: 0px;    background-color: #b49132; height: 11mm; }
         footer .footerText { font-size: 14px; text-align: center; color: white;    font-family: 'Montserrat-Medium'; font-weight:400; padding-top:8px; }
         content{
         height:645px;
         padding:0px 30px;
         }

正如你所看到的,我试图通过使用{{ headerTExt }}将动态标题文本设置在我的模板文件中,并使用变量{% set headerTExt = 'asdf' %},但它无效。如果我把静态文本,它的工作,但动态不工作。

有人可以指导我如何使它工作

php octobercms octobercms-plugins octobercms-widgets
1个回答
2
投票

您正在寻找{% placeholder %}https://octobercms.com/docs/markup/tag-placeholder

模板文件:

{% put headerText %}Test{% endput %}

布局文件:

<html>
    <head>
        // etc
    </head>
    <body>
        <div id="header">
            {% placeholder 'headerText' %}
        </div>
    </body>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.