I've searched far and wide for an answer and haven't found one. A little history...I coded these pages 25 years ago (HTML/CSS/PHP), left my coding job to pursue other things, and have been thrown back into it for updates. So I'm quite out of the loop.
Here's what I CAN code:
- a variable page number that floats at the bottom of content (not the bottom of the printed page) OR
- a footer at the bottom of the page that's exactly the same on every page (without counting pages)
At this time, here is the relevant code (although there are many more styles not listed here. If you think there might be something to check on, please let me know.)
Styles:
P.breakhere {
page-break-before: always;
}
@media print {
div.divFooter {
position: fixed;
bottom: 0;
}
}
Within the html, I have:
<div class="divFooter"> Contract # <?php print $line["contract_num"]; ?> Page 2 of 3 </div>
I have one of these on each page for each page number and it's printing all 3 of them on every page.
I've also tried:
<?php $page = 1; ?>
<div class="divFooter">Contract # <?php
print $line["contract_num"];
print " Page " . $page . " of 3";
$page = $page + 1;
?>
</div>
The result of this is "Contract 3867 Page of 3" on each page. (Missing page number.)
I've also tried:
STYLES
.mypage {
page-break-after: always;
break-after: page;
}
.mypage-footer{
display: table-footer-group;
}
.mypage-footer:after{
counter-increment: page;
content: counter(page) ' of ' counter(pages);
}
Where I wrap the whole page in a div tag like:
<div class="mypage">[content]
<div class="mypage-footer">
<span class="bodytextitalics">Contract # <?php print $line["contract_num"]; ?> Page </span>
</div>
</div>
This didn't work either. I don't remember the exact results.
Here's what I want:
(Page 1 content)
(Page 1 footer) Contract 3785 Page 1 of 3
(Page 2 content)
(Page 2 footer) Contract 3785 Page 2 of 3
(Page 3 content)
(Page 3 footer) Contract 3785 Page 3 of 3