I also discovered I don’t really need a template engine for the custom CMS I’m developing, off and on. I’m generating HTML files and I can manipulate the source files with PHP alone. Using a template engine would add a level of complexity that would make things harder to manage, not easier.
There’s a handful of template engines I looked at. Here’s the list:
There’s a bunch of things on an HTML page the average visitor will never see. Some people will see that stuff simply because curiosity will cause them to look at the web browser source of the page. It’s that “invisible” stuff that causes all the headaches.
My solution is to use the index file to build each html page using the requested URI (like “/this-page.html”), including a header before it and a footer after it. Since all three sections will be in memory at the same time, I only need to replace “variables” with some lines included at the top of the HTML file.
It’s the header file that will cause me the most grief. Along with the stuff that’s been around forever, I also have to account for Open Graph items and structured data markup.
I’ve tried to live with that philosophy most of my adult life. That started soon after Bert Lance coined the phrase in 1977. I can’t tell you how many times I’ve seen people change things just for the sake of change.
I’m not planning to change anything that I have in place now. The CMS project I’m working on is completely separate and something I want to perfect for other sites I may (or may not) create.