equal
deleted
inserted
replaced
|
1 <?php |
|
2 require_once(realpath(dirname(__FILE__) . "/../config.php")); |
|
3 |
|
4 function renderLayoutWithContentFile($contentFile, $variables = array(), $css=array()) |
|
5 { |
|
6 $contentFileFullPath = TEMPLATES_PATH . "/" . $contentFile; |
|
7 |
|
8 // making sure passed in variables are in scope of the template |
|
9 // each key in the $variables array will become a variable |
|
10 if (count($variables) > 0) { |
|
11 foreach ($variables as $key => $value) { |
|
12 if (strlen($key) > 0) { |
|
13 ${$key} = $value; |
|
14 } |
|
15 } |
|
16 } |
|
17 |
|
18 require_once(TEMPLATES_PATH . "/header.php"); |
|
19 |
|
20 echo "<div id=\"container\">\n" |
|
21 . "\t<div id=\"content\">\n"; |
|
22 |
|
23 if (file_exists($contentFileFullPath)) { |
|
24 require_once($contentFileFullPath); |
|
25 } else { |
|
26 /* |
|
27 If the file isn't found the error can be handled in lots of ways. |
|
28 In this case we will just include an error template. |
|
29 */ |
|
30 require_once(TEMPLATES_PATH . "/error.php"); |
|
31 } |
|
32 |
|
33 // close content div |
|
34 echo "\t</div>\n"; |
|
35 |
|
36 // close container div |
|
37 echo "</div>\n"; |
|
38 |
|
39 require_once(TEMPLATES_PATH . "/footer.php"); |
|
40 } |