server/php/basic/resources/library/templateFunctions.php
changeset 541 05ad3a6f58e5
parent 442 adb907bba956
--- a/server/php/basic/resources/library/templateFunctions.php	Tue Sep 22 00:03:37 2015 +0200
+++ b/server/php/basic/resources/library/templateFunctions.php	Tue Sep 22 00:04:14 2015 +0200
@@ -1,40 +1,41 @@
 <?php
-    require_once(realpath(dirname(__FILE__) . "/../config.php"));
 
-    function renderLayoutWithContentFile($contentFile, $variables = array(), $css=array())
-    {
-        $contentFileFullPath = TEMPLATES_PATH . "/" . $contentFile;
+require_once realpath(dirname(__FILE__).'/../config.php');
 
-        // making sure passed in variables are in scope of the template
-        // each key in the $variables array will become a variable
-        if (count($variables) > 0) {
-            foreach ($variables as $key => $value) {
-                if (strlen($key) > 0) {
-                    ${$key} = $value;
-                }
+function renderLayoutWithContentFile($contentFile, $variables = array(), $css = array())
+{
+    $contentFileFullPath = TEMPLATES_PATH.'/'.$contentFile;
+
+    // making sure passed in variables are in scope of the template
+    // each key in the $variables array will become a variable
+    if (count($variables) > 0) {
+        foreach ($variables as $key => $value) {
+            if (strlen($key) > 0) {
+                ${$key} = $value;
             }
         }
-
-        require_once(TEMPLATES_PATH . "/header.php");
+    }
 
-        echo "<div id=\"container\">\n"
-           . "\t<div id=\"content\">\n";
+    require_once TEMPLATES_PATH.'/header.php';
+
+    echo "<div id=\"container\">\n"
+       ."\t<div id=\"content\">\n";
 
-        if (file_exists($contentFileFullPath)) {
-            require_once($contentFileFullPath);
-        } else {
-            /*
-                If the file isn't found the error can be handled in lots of ways.
-                In this case we will just include an error template.
-            */
-            require_once(TEMPLATES_PATH . "/error.php");
-        }
+    if (file_exists($contentFileFullPath)) {
+        require_once $contentFileFullPath;
+    } else {
+        /*
+            If the file isn't found the error can be handled in lots of ways.
+            In this case we will just include an error template.
+        */
+        require_once TEMPLATES_PATH.'/error.php';
+    }
 
-        // close content div
-        echo "\t</div>\n";
+    // close content div
+    echo "\t</div>\n";
 
-        // close container div
-        echo "</div>\n";
+    // close container div
+    echo "</div>\n";
 
-        require_once(TEMPLATES_PATH . "/footer.php");
-    }
+    require_once TEMPLATES_PATH.'/footer.php';
+}