You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
385 B
PHP
17 lines
385 B
PHP
<?php
|
|
|
|
|
|
// Load and render template
|
|
function template_render($file, $data) {
|
|
if (file_exists($file)) {
|
|
$template = file_get_contents($file);
|
|
if (is_array($data))
|
|
foreach ($data as $name => $content) {
|
|
$template = str_replace("%" . $name . "%", $content, $template);
|
|
}
|
|
return $template;
|
|
} else {
|
|
die('Cannot find template file «' . $file . '».');
|
|
}
|
|
}
|
|
?>
|