From a9057c94f4e423057222e6f6db3883cbce5017d7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 5 Jun 2014 20:40:34 +0200 Subject: Add functions to add script includes to the beginning or end of the document to Render class --- inc/render.inc.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'inc/render.inc.php') diff --git a/inc/render.inc.php b/inc/render.inc.php index 6c746c93..9bea4639 100644 --- a/inc/render.inc.php +++ b/inc/render.inc.php @@ -18,6 +18,7 @@ class Render private static $mustache = false; private static $body = ''; private static $header = ''; + private static $footer = ''; private static $title = ''; private static $templateCache = array(); private static $tags = array(); @@ -66,7 +67,10 @@ class Render - ' + ', + self::$footer + , + '' ; if ($zip) { Header('Content-Encoding: gzip'); @@ -94,6 +98,34 @@ class Render self::$header .= $html . "\n"; } + /** + * Add raw html data to the footer-section of the generated page (after the closing body tag) + */ + public static function addFooter($html) + { + self::$footer .= $html . "\n"; + } + + /** + * Add given js script file from the script directory to the header + * + * @param string $file file name of script + */ + public static function addScriptTop($file) + { + self::addHeader(''); + } + + /** + * Add given js script file from the script directory to the bottom + * + * @param string $file file name of script + */ + public static function addScriptBottom($file) + { + self::addFooter(''); + } + /** * Add the given template to the output, using the given params for placeholders in the template */ -- cgit v1.2.3-55-g7522