From 5779a52b9163a2b8f281fecc9b0413bd580906a2 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 14 Aug 2011 13:45:48 -0400 Subject: [PATCH] Add hoplite\views\Inject() --- views/template.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/views/template.php b/views/template.php index 8814f19..bb18890 100644 --- a/views/template.php +++ b/views/template.php @@ -18,11 +18,21 @@ namespace hoplite\views; require_once HOPLITE_ROOT . '/base/filter.php'; +/* + Renders a template with additional vars. + @param string The template name to render + @param array Variables with which to render. +*/ +function Inject($name, $vars = array()) +{ + echo TemplateLoader::Fetch($name)->Render($vars); +} + /*! - A Template is initialized with a text file (typically HTML) and can render it - with data from some model. It has a short macro expansion system, equivalent - to PHP short open tags, but usable on all installations. Template caching of - the parsed state is available. + A Template is initialized with a text file (typically HTML) and can render it + with data from some model. It has a short macro expansion system, equivalent + to PHP short open tags, but usable on all installations. Template caching of + the parsed state is available. */ class Template { -- 2.22.5