mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
37 lines
885 B
PHP
Executable File
37 lines
885 B
PHP
Executable File
<?php
|
|
############################################################
|
|
## ##
|
|
## Test functions so far mini template parser ##
|
|
## Author : Advocaite ##
|
|
## Project : TravianX ##
|
|
## ##
|
|
############################################################
|
|
function addSub($subName, $sub)
|
|
{
|
|
$GLOBALS['subs']["{".$subName."}"] = $sub;
|
|
}
|
|
|
|
function template($filepath, $subs)
|
|
{
|
|
global $s;
|
|
if(file_exists($filepath))
|
|
{
|
|
$text = file_get_contents($filepath);
|
|
} else {
|
|
print "File '$filepath' not found";
|
|
return false;
|
|
}
|
|
|
|
foreach($subs as $sub => $repl)
|
|
{
|
|
$text = str_replace($sub, $repl, $text);
|
|
}
|
|
|
|
ob_start();
|
|
eval("?>".$text);
|
|
$text = ob_get_contents();
|
|
ob_end_clean();
|
|
return $text;
|
|
}
|
|
|
|
?>
|