Add static InlineRender method to CPHP Templater

feature/node-rewrite
Sven Slootweg 13 years ago
parent a7408bd659
commit 70a5fb56a5

@ -120,4 +120,13 @@ class Templater
Throw new Exception("No template loaded.");
}
}
public static function InlineRender($templatename, $localize = array(), $compile = array())
{
$template = new Templater();
$template->Load($templatename);
$template->Localize($localize);
$template->Compile($compile);
return $template->Render();
}
}

@ -8,10 +8,7 @@ $settings['salt'] = "kAU0qM";
$sContainer = new Container(1);
$template_main = new Templater();
$template_main->Load("main");
$template_main->Localize($locale->strings);
$template_main->Compile(array(
echo(Templater::InlineRender("main", $locale->strings, array(
'server-location' => $sContainer->sNode->sPhysicalLocation,
'operating-system' => $sContainer->sTemplate->sName,
'guaranteed-ram' => "{$sContainer->sGuaranteedRam}MB",
@ -19,7 +16,6 @@ $template_main->Compile(array(
'disk-space' => "{$sContainer->sDiskSpace}MB",
'total-traffic-limit' => "{$sContainer->sTotalTrafficLimit} bytes",
'bandwidth-limit' => "100mbit",
));
$template_main->Output();
)));
?>

Loading…
Cancel
Save