PHP Template help

HI!
For a school project we had to make a dynamic web page, and seperate server-side code with client-side code.

So i googled for different solutions and found different templates like smarty and such, but they where all verry complicated. I found one, that was easy to use, with a couple of changes I got the desired easy template.

Though here’s the problem. How can I make php loop a certain part of the template file**???**

heres my “mixer” that sets the parameter:

<?php
class Page
{
var $page;

function Page($template = '') {
if (file_exists($template))
$this->page = join('', file($template));
else
die("Template file $template not found.");
}

function parse($file) {
ob_start();
include($file);
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}

function replace_tags($tags = array()) {
if (sizeof($tags) > 0)
foreach ($tags as $tag => $data) {
$data = (file_exists($data)) ? $this->parse($data) :
$data;
$this->page = eregi_replace('--' . $tag . '--', $data,
$this->page);
}
else
die('No tags designated for replacement.');
}

function output() {
print($this->page);
}
}
?> 

and here’s the output file:

<?php 
require_once('phpmixer.php');
$db = mysql_connect("host","DB_name","password"); 
mysql_select_db ("db_name") or die ("Cannot connect to database"); 


$query = "SELECT title, description, web, author, date, email FROM tuts ORDER BY id DESC";
$result = mysql_query($query); 


/* fetch the result as an array */ 

while($r=mysql_fetch_array($result)) {    

 $page = new Page('view.htm');
 
    $title=$r['title'];
    $description=$r["description"]; 
    $webpage=$r["web"]; 
    $author=$r["author"]; 
    $email=$r["email"]; 
    $date=$r["date"];     


$page->replace_tags(array(
'title' => $title,
'description' => $description,
'web' => $webpage,
'email' => $email,
'author' => $author,
'date' => $date));



$page->output();
}
mysql_close($db); 

?>

The html page has tags like these “–title–” where the desired content fits!

I hope someone can help me, if not, I hope someone can get some help from the code :wink:

Thanx in advance!