From e31f671c85aea54f47a913398c1a03804d1565bc Mon Sep 17 00:00:00 2001 From: nbm Date: Sat, 19 Nov 2005 20:48:42 +0000 Subject: [PATCH] Put $main truly into the global scope using $GLOBALS. --- lib/templating/kt3template.inc.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php index d3f7c7e..4feb907 100644 --- a/lib/templating/kt3template.inc.php +++ b/lib/templating/kt3template.inc.php @@ -18,6 +18,7 @@ class KTPage { /** resources are "filename"->1 to allow subcomponents to require items. */ var $js_resources = Array(); var $css_resources = Array(); + var $js_standalone = Array(); /** context-relevant information */ var $errStack = Array(); @@ -88,7 +89,6 @@ class KTPage { // require that the specified JS file is referenced. function requireJSResource($sResourceURL) { $this->js_resources[$sResourceURL] = 1; // use the keys to prevent multiple copies. - } // require that the specified JS files are referenced. @@ -102,6 +102,14 @@ class KTPage { function getJSResources() { return array_keys($this->js_resources); } + + function requireJSStandalone($sJavascript) { + $this->js_standalone[$sJavascript] = 1; // use the keys to prevent multiple copies. + } + // list the distinct js resources. + function getJSStandalone() { + return array_keys($this->js_standalone); + } /* css handling */ // require that the specified CSS file is referenced. @@ -190,6 +198,15 @@ class KTPage { /* final render call. */ function render() { + + if (empty($this->contents)) { + $this->contents = ""; + } + + if (is_string($this->contents) && (trim($this->contents) === "")) { + $this->addError("This page did not produce any content"); + $this->contents = ""; + } if (!is_string($this->contents)) { $this->contents = $this->contents->render(); @@ -224,6 +241,6 @@ class KTPage { } /* set $main - this is used by the rest of the system. */ -$main = new KTPage(); +$GLOBALS['main'] = new KTPage(); -?> \ No newline at end of file +?> -- libgit2 0.21.4