uff
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
class tpl {
|
||||
static $blocks = array();
|
||||
static $views_path = '/home/users/flumm/www/dev.fwtrash.de/views/';
|
||||
static $cache_path = '/home/users/flumm/tmp/';
|
||||
|
||||
static function view($file, $data = array()) {
|
||||
@ -32,12 +33,11 @@ class tpl {
|
||||
}
|
||||
|
||||
static function includeFiles($file) {
|
||||
$code = file_get_contents($file);
|
||||
$code = file_get_contents(self::$views_path . $file);
|
||||
preg_match_all('/{% ?(extends|include) ?\'?(.*?)\'? ?%}/i', $code, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $value)
|
||||
$code = str_replace($value[0], self::includeFiles($value[2]), $code);
|
||||
$code = preg_replace('/{% ?(extends|include) ?\'?(.*?)\'? ?%}/i', '', $code);
|
||||
return $code;
|
||||
return preg_replace('/{% ?(extends|include) ?\'?(.*?)\'? ?%}/i', '', $code);
|
||||
}
|
||||
|
||||
static function compilePHP($code) {
|
||||
@ -69,8 +69,7 @@ class tpl {
|
||||
static function compileYield($code) {
|
||||
foreach(self::$blocks as $block => $value)
|
||||
$code = preg_replace('/{% ?yield ?' . $block . ' ?%}/', $value, $code);
|
||||
$code = preg_replace('/{% ?yield ?(.*?) ?%}/i', '', $code);
|
||||
return $code;
|
||||
return preg_replace('/{% ?yield ?(.*?) ?%}/i', '', $code);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user