format_template($template); if(!file_exists($template)) { trigger_error("Template '$template' does not exist", E_USER_ERROR); } foreach($data as $name => $value) { $$name = $value; } include $template; } function format_template(&$template) { $template = $this->TEMPLATE_DIR . $template . $this->TEMPLATE_EXT; } }