mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 12:36:23 +05:30
Fix: Issue #58 Error logs
This commit is contained in:
parent
1b5e52e497
commit
f1ec5a0566
1 changed files with 34 additions and 36 deletions
|
|
@ -272,53 +272,51 @@ function content($value = null) {
|
|||
}
|
||||
|
||||
function render($view, $locals = null, $layout = null) {
|
||||
|
||||
if(!login()) {
|
||||
$c = str_replace('/', '#', str_replace('?', '~', $_SERVER['REQUEST_URI']));
|
||||
$dir = 'cache/page';
|
||||
$cachefile = $dir. '/' . $c . '.cache';
|
||||
if(is_dir($dir) === false) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($locals) && count($locals)) {
|
||||
extract($locals, EXTR_SKIP);
|
||||
}
|
||||
|
||||
if (($view_root = config('views.root')) == null)
|
||||
error(500, "[views.root] is not set");
|
||||
|
||||
ob_start();
|
||||
include "{$view_root}/{$view}.html.php";
|
||||
content(trim(ob_get_clean()));
|
||||
|
||||
if ($layout !== false) {
|
||||
|
||||
if ($layout == null) {
|
||||
$layout = config('views.layout');
|
||||
$layout = ($layout == null) ? 'layout' : $layout;
|
||||
}
|
||||
|
||||
$layout = "{$view_root}/{$layout}.html.php";
|
||||
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
ob_start();
|
||||
require $layout;
|
||||
|
||||
if(!login()) {
|
||||
if (!file_exists($cachefile)) {
|
||||
file_put_contents($cachefile, ob_get_contents());
|
||||
}
|
||||
$login = login();
|
||||
if(!$login) {
|
||||
$c = str_replace('/', '#', str_replace('?', '~', $_SERVER['REQUEST_URI']));
|
||||
$dir = 'cache/page';
|
||||
$cachefile = $dir. '/' . $c . '.cache';
|
||||
if(is_dir($dir) === false) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
}
|
||||
|
||||
echo trim(ob_get_clean());
|
||||
|
||||
} else {
|
||||
echo content();
|
||||
}
|
||||
if (is_array($locals) && count($locals)) {
|
||||
extract($locals, EXTR_SKIP);
|
||||
}
|
||||
|
||||
if (($view_root = config('views.root')) == null)
|
||||
error(500, "[views.root] is not set");
|
||||
|
||||
ob_start();
|
||||
include "{$view_root}/{$view}.html.php";
|
||||
content(trim(ob_get_clean()));
|
||||
|
||||
if ($layout !== false) {
|
||||
|
||||
if ($layout == null) {
|
||||
$layout = config('views.layout');
|
||||
$layout = ($layout == null) ? 'layout' : $layout;
|
||||
}
|
||||
|
||||
$layout = "{$view_root}/{$layout}.html.php";
|
||||
|
||||
header('Content-type: text/html; charset=utf-8');
|
||||
|
||||
ob_start();
|
||||
require $layout;
|
||||
|
||||
if(!$login) {
|
||||
if (!file_exists($cachefile)) {
|
||||
file_put_contents($cachefile, ob_get_contents());
|
||||
}
|
||||
}
|
||||
|
||||
echo trim(ob_get_clean());
|
||||
} else {
|
||||
echo content();
|
||||
}
|
||||
}
|
||||
|
||||
function json($obj, $code = 200) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue