I want to make developing on my new projects easier, and I wanted a bare bones very simple template engine solution. I looked around on the net and everything is either too bloated, or makes me cringe.
My HTML files will be like so:
<html>
<head>
<title>{PAGE_TITLE}</title>
</head>
<body>
<h1>{PAGE_HEADER}</h1>
<p>Some random content that is likely not to be parsed with PHP.</p>
</body>
</html>
Obviously, I want to replace {PAGE_TITLE}
and {PAGE_HEADER}
with something I set with PHP. Like this:
<?php
$pageElements = array(
'{PAGE_TITLE}' => 'Some random title.',
'{PAGE_HEADER}' => 'A page header!'
);
?>
And I'd use something like str_replace
and load the replaced HTML into a string, then print it to the page? This is what I'm on the path towards doing at the moment... does anyone have any advice or a way I can do this better?
Thanks.