this is my php file:
Code: Select all
<?php
$title="New Title";
$text=file_get_contents("temp1.html");
function replace($str)
{
$sub=substr($str[0],1,-1);
$sub='$'.$sub;
return $sub;
}
$text=preg_replace_callback("|(\{)(\w+)(\})|","replace",$text);
eval('echo $text;');
?>
and this is the included temp1.html:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{title}</title>
</head>
<body>
</body>
</html>
Problem is same as before, the page title is coming as $title and not "New Title".
Also please comment on the way I am trying to make templates, I don't quite like it. I need these to build 8-10 page websites.