]>
git.bts.cx Git - cx.git/blob - cx/lib/template.php
3 function cx_template_render($class, $name, $variables = null) {
4 global $cx_template_base, $cx_template_content;
9 while ($name != null) {
10 $segments = array(CX_PATH
, 'templates', $class, $name . '.php');
11 $path = join(DIRECTORY_SEPARATOR
, $segments);
13 $base_template = null;
14 $base_template_variables = null;
16 $cx_template_base_previous = $cx_template_base;
17 $cx_template_base = function($name, $base_variables) use (&$base_template, &$base_template_variables) {
18 $base_template = $name;
19 $base_template_variables = $base_variables;
22 $cx_template_content_previous = $cx_template_content;
23 $cx_template_content = function() use ($output) {
27 cx_require('lib', 'url.php'); // For templates
29 if ($variables != null) {
35 $output = ob_get_contents();
38 $cx_template_base = $cx_template_base_previous;
39 $cx_template_content = $cx_template_content_previous;
41 $name = $base_template;
42 $variables = $base_template_variables;
48 function cx_template_base($name, $variables = null) {
49 global $cx_template_base;
50 $cx_template_base($name, $variables);
53 function cx_template_content() {
54 global $cx_template_content;
55 return $cx_template_content();