Loading template file and replacing placeholders
I would say suggest writing your input like so:

function replace_tags($template, $placeholders){
    $placeholders = array_merge($placeholders, array('&lt;?'=&gt;'', '?&gt;'=&gt;''));
    return str_replace(array_keys($placeholders), $placeholders, $template);
}

$vars = array('{{NAME}}'=&gt;'Bob', '{{USERNAME}}'=&gt;'user_name');
$template = file_get_contents('template.tmpl', true);

echo replace_tags($template, $vars);


So that you can define the constant changes, and the changes you want to build depending on user, etc.