PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
function fetch_template($template,$data = null){
eval('?'.'>'.trim($template).'<'.'?');
}
$templatequery = $mysql->query("SELECT * FROM ".DBPREFIX."templates ORDER by name ASC");
while ($templ = mysql_fetch_array($templatequery,MYSQL_ASSOC))
{
$template[$templ['name']] = $templ['body'];
}
$data['title'] = "Site Name";
fetch_template("header",$data);
?>
I saw this in a framework I was studying. How would I display the title in the header template with out echoing $data['title']. The framework did echo $title. How would I make all variables come from the $data array?