I need to create a small and simple php template engine, which I searched a lot, and many of them were too complicated to understand, and I do not want to use smarty and other similar engines, I have an idea from Stack Overflow, this:
$template = file_get_contents('file.html');
$array = array('var1' => 'value',
'txt' => 'text');
foreach($array as $key => $value)
{
$template = str_replace('{'.$key.'}', $value, $template);
}
echo $template;
Now, instead of the echo, the template that I just want to add includes "file.html" and it will display the file with the correct variable values, and I want to put the engine in a separate place and just include it in the template, that I want to use it to declare array, and at the end include an html file, for example phpbb. Sorry, I ask a lot, but can anyone explain the basic concept of this?
EDIT: , , script, , , phpbb, , , . ..: p