Template.php
<body>
{ Web Title }
<hr />
{ Current Intro }
</body>
^ This is the most basic html template.
Foo.php
$title = "Introduction to templates";
$intro = "INTROOOO! Hello!";
get_file_contents(template.php);
str_replace("{ Web Title }", $title);
str_replace("{ Current Intro }", $intro);
^ This is the php that takes the template and replaces the 'place holders'. Very basic, very messy and probably full of bugs but that should give you an idea.