diff --git a/inc/db.inc.php b/inc/db.inc.php
index 4d70abb..f9808c1 100644
--- a/inc/db.inc.php
+++ b/inc/db.inc.php
@@ -1,6 +1,4 @@
sql->dsn,
$config->sql->user,
@@ -10,4 +8,3 @@ $db = new PDO(
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ
]
);
-?>
diff --git a/inc/router.inc.php b/inc/router.inc.php
index f43f2a1..b53a693 100644
--- a/inc/router.inc.php
+++ b/inc/router.inc.php
@@ -1,4 +1,6 @@
env->cache))
+ mkdir($config->env->cache, 0744);
+ $cached_file = $config->env->cache . str_replace(array('/', '.html'), array('_', ''), $file . '.php');
if(!file_exists($cached_file) || filemtime($cached_file) < filemtime($file)) {
$code = self::includeFiles($file);
$code = self::compileCode($code);
@@ -33,7 +32,8 @@ class tpl {
}
static function includeFiles($file) {
- $code = file_get_contents(self::$views_path . $file);
+ global $config;
+ $code = file_get_contents($config->env->views . $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);
@@ -72,4 +72,3 @@ class tpl {
return preg_replace('/{% ?yield ?(.*?) ?%}/i', '', $code);
}
}
-?>
diff --git a/index.php b/index.php
index 8b84d90..1a50de5 100644
--- a/index.php
+++ b/index.php
@@ -1,9 +1,6 @@
debug) {
tpl::view($tpl->file,
array_merge([
'page' => $_page,
- 'generated' => $generated
+ 'generated' => $generated,
+ 'basepath' => $config->env->basepath
],
gettype($tpl->data) !== 'string' ? $tpl->data : [])
);
diff --git a/public/index.php b/public/index.php
index 10ab191..429613c 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,2 +1,7 @@
-