1 <?php
defined('IN_CMS') or die('No direct access allowed.');
7 public static function path($path = '') {
12 static::$path = $path;
15 private static function parse($file, $data) {
16 // render content into response
20 extract($data, EXTR_SKIP
);
24 Response
::append(ob_get_contents());
29 public static function render($template, $data = array()) {
31 $theme = Config
::get('metadata.theme');
33 // load global theming functions but not for the admin template
34 if(strpos(static::$path, 'system/admin/theme') === false) {
35 require PATH
. 'system/functions/articles.php';
36 require PATH
. 'system/functions/comments.php';
37 require PATH
. 'system/functions/helpers.php';
38 require PATH
. 'system/functions/menus.php';
39 require PATH
. 'system/functions/metadata.php';
40 require PATH
. 'system/functions/pages.php';
41 require PATH
. 'system/functions/posts.php';
42 require PATH
. 'system/functions/search.php';
43 require PATH
. 'system/functions/users.php';
46 // load theme functions
47 if(file_exists(static::$path . 'functions.php')) {
48 require static::$path . 'functions.php';
52 foreach(array('includes/header', $template, 'includes/footer') as $file) {
53 $filepath = static::$path . $file . '.php';
55 if(file_exists($filepath) === false) {
56 throw new ErrorException('Theme file <strong>themes/' . $theme . '/' . $file . '.php</strong> not found.');
59 static::parse($filepath, $data);