“Poor Man’s” CMS From The Ground Up — Part 2, Outer Markup And Templates

Jason Knight
CodeX
Published in
15 min readFeb 6, 2023

--

A medieval caballero, aka an armored knight.
Caballero, I like the word. Knight, horseman, gentleman.

In our previous outing I got everything right up to — but not including — actually outputting anything complete. Now it’s time to make it actually do that output.

I’ve also chosen a name for it. Prior systems I’ve build the “brickwork” without database was called “Squire” and a complete database powered monster was called “Paladin”. This time around, let’s call it “Caballero”, the medieval Spanish word for a knight on horseback. Got to have a cutesy name.

Now, let’s get into making this output something, and where to start with that is…

Header And Footer Tag Management

There are tags that well built pages should use in a uniform manner that have nothing to do with being part of the “template”. They do not change just because you reskinned the page. To handle this I have a common htmlHeaderFooter.lib.php containing two static objects for handling / buffering the output of them, so they can be applied in a clear and uniform manner. The tags in question are everything between and including the DOCTYPE and opening <body>, and everything after the primary content of the page such as modal dialogs and <script> right through to closing </html>.

--

--

Jason Knight
CodeX

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse