PHP Code:
index.php
<html>
<head>
</head>
<body>
<p> what if I don't want this to be changed???</p>
<div>
<span onclick='dyna("template.html")'>click me</span>
</div>
</body>
</html>
<?php
function dyna($f) {
$template=implode("",file($f));
$template=str_replace("{title}","Manipulated",$template); //changes the string '{title}' in template.html to the string 'Manipulated'
$template=str_replace("{contents}",implode("",file("content.txt")),$template);//changes the string '{contents}' to whatever is inside content.txt
echo $template;
}
?>
Code:
//Template.html
<html>
<head>
<title>{title}</title>
</head>
<body>
{contents}
</body>
</html>
Code:
content.txt
ipsum........