]>
git.bts.cx Git - cx.git/blob - cx/lib/template.php
3 function cx_template_render($class, $name, $variables = []) {
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;
15 $cx_template_base_previous = $cx_template_base;
16 $cx_template_base = function($name) use (&$base_template ) {
17 $base_template = $name;
20 $cx_template_content_previous = $cx_template_content;
21 $cx_template_content = function() use ($output) {
25 cx_require('lib', 'url.php'); // For templates
30 $output = ob_get_contents();
33 $cx_template_base = $cx_template_base_previous;
34 $cx_template_content = $cx_template_content_previous;
36 $name = $base_template;
42 function cx_template_base($name) {
43 global $cx_template_base;
44 $cx_template_base($name);
47 function cx_template_content() {
48 global $cx_template_content;
49 return $cx_template_content();