Hi
You can tackle this in 2 ways - functions or classes. As this post is on the newbie board then i am assuming that you are relatively new to php so a function will be easier.
heres a really easy example (from which i hope you can grasp the concepts)
function create_page($title,$body)
{
$page =<<<EOD
<html>
<head>
<title>$title</title>
</head>
<body>
$body
</body>
</html>
EOD;
print $page
}
OK so now i'll go though it. the function above simply writes a basic html page with the variables $title and $body being put in the relevant places within the html code.
so to use it you'd simply write (in your php code)
<?
create_page("This is my first tempalted page","Welcome to my first tempalte page");
?>
The beauty of using this approach (and the class approach) is that its very easy to actually generate the html.
Contact me if you want more help
HTH
GM