I am using OctoberCMS DynamicPDF Plugin which is working absolutely fine as per my requirement.
Howerver, I have dynamic PDF header text content and I am trying to Overwrite my Header Content but its not working. Here is what I have tried so far.
Template file
{% set headerTExt = 'asdf' %}
Layout file
<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>
Layout File 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;
}
As you can see, I am trying to put dynamic header text by using {{ headerTExt }}
by setting it inside my Template file with variable {% set headerTExt = 'asdf' %}
but its not working. If I put static text, its working but dynamic not working.
Can someone guide me how can I make it work
You're looking for {% placeholder %}
: https://octobercms.com/docs/markup/tag-placeholder
Template File:
{% put headerText %}Test{% endput %}
Layout File:
<html>
<head>
// etc
</head>
<body>
<div id="header">
{% placeholder 'headerText' %}
</div>
</body>
</html>