would be better to pull templates from flat file, as your way adds an unneeded query that could cripple your server under high loads
example:
create a file say post.html and put it in templates folder
then put variables such as ##header## in that file then create a php page with this code
$SQL = mysql_query("SELECT * FROM Table WHERE ID = '1'");
$Data = mysql_fetch_ojbect($SQL);
$Template = file_get_contents("templates/post.html");
$Output = str_replace("##header##", $Data->Title, $Template);
echo $Output;
|