Ejemplo n.º 1
0
$layout_path = $htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . $htmlwarrior->config["path_templates_layouts"] . '/' . $htmlwarrior->layout . '.tpl';
// Get all variables indents so we can indent the content right
// We're after the $yield variable indent now
$variable_indents = get_indents_for_variables(file_get_contents($layout_path));
// set variables
// should these be added to layout template object (which we don't have yet)
foreach ($page_variables as $key => $var) {
    $smarty->assign($key, $var);
}
$yield = indent(remove_variables($page_content), $variable_indents['yield']);
$yield = ltrim($yield);
$smarty->assign('yield', $yield);
unset($yield);
// add access log; must be after frontpage so we don't log that
if ($htmlwarrior->config['log']) {
    add_access_log(array('site_dir' => $htmlwarrior->runtime['site_dir'], 'url' => $_SERVER['REQUEST_URI']));
}
//require_once('filelist.php');
ob_start('callback');
if ($page_variables['layout'] === false) {
    $layout_path = $htmlwarrior->config['code_path'] . $htmlwarrior->config['path_templates_layouts'] . '/' . 'empty.tpl';
}
$smarty->display($layout_path);
$htmlwarrior->config['devmode'] = false;
$content = $smarty->fetch($layout_path);
@ob_end_flush();
if ($htmlwarrior->config['build']) {
    build_template($htmlwarrior->config['basepath'] . '/' . $htmlwarrior->runtime['site_dir'] . '/' . $htmlwarrior->config['build_dir'] . '/' . $htmlwarrior->page . '.html', $content, $template_filetime);
}
if ($htmlwarrior->config['debug']) {
    $time_end = microtime(1) - $time_start;
Ejemplo n.º 2
0
$layout_path = "layouts/" . $smartysh->layout . ".tpl";
$variable_indents = get_indents_for_variables(file_get_contents($smarty->template_dir . "/" . $layout_path));
if (isset($page_variables["title"])) {
    $smarty->assign("title", $page_variables["title"]);
} else {
    $smarty->assign("title", "");
}
if (isset($page_variables["custom1"])) {
    $smarty->assign("custom1", $page_variables["custom1"]);
} else {
    $smarty->assign("custom1", "");
}
$smarty->assign("yield", indent(remove_variables($page_content), $variable_indents["yield"]));
// add access log; must be after frontpage so we don't log that
if ($smartysh->config["log"]) {
    add_access_log(array("site_dir" => $smartysh->runtime["site_dir"], "url" => $_SERVER["REQUEST_URI"]));
}
require_once $smartysh->config["basepath"] . "/" . $smartysh->runtime["site_dir"] . "/cfg/config.php";
//require_once("filelist.php");
ob_start("callback");
$smarty->display($layout_path);
$smarty->assign("debug", 0);
$content = $smarty->fetch($layout_path);
@ob_end_flush();
if ($smartysh->config["build"]) {
    build_template($smartysh->config["basepath"] . "/" . $smartysh->runtime["site_dir"] . "/" . $smartysh->config["build_dir"] . "/" . $smartysh->page . ".html", $content, $template_filetime);
}
if ($smartysh->config["debug"]) {
    $time_end = microtime(1) - $time_start;
    echo "<!--";
    echo "Script load time: " . $time_end;