我使用的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' %},但它不起作用。如果我把静态文本,它的工作,但动态不起作用。
有人能指导我怎样才能让它起作用吗?
发布于 2019-04-16 13:08:03
你在找{% 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>https://stackoverflow.com/questions/55708749
复制相似问题