Add hoplite\views\Inject()
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 14 Aug 2011 17:45:48 +0000 (13:45 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 14 Aug 2011 17:45:48 +0000 (13:45 -0400)
views/template.php

index 8814f19c51e4fe544aadd220a502b68d88910ac7..bb188909d93fb12d17880ac9b9602dc3b29e8449 100644 (file)
@@ -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
 {