Пример #1
0
function page_p($id, $edit = true)
{
    if (is_numeric($id)) {
        $page = db_object_get("pages", $id);
    } else {
    }
    if ($page) {
        //file_put_contents("content.txt", $page->content);
        $o = fld_trans($page->content);
        if (function_exists("on_page_content")) {
            on_page_content($o);
        }
    } else {
        $o = "not defined";
    }
    if ($edit) {
        $o .= p_quickedit_html($id);
    }
    replace_my_tags($o);
    // {href {f {call
    if (form_post("die")) {
        replace_files($o);
        // {!something.js} {!something.css}
        replace_globals($o);
        // {!global} {!global}
        translate_parse($o);
        // {~rus} {~eng}
        die($o);
    }
    return $o;
}
Пример #2
0
function page_p($id)
{
    $page = db_object_get("pages", $id);
    if ($page) {
        $o = $page->content;
    } else {
        $o = "not defined";
    }
    $o .= p_quickedit_html($id);
    replace_my_tags($o);
    // {href {f {call
    if (form_post("die")) {
        replace_files($o);
        // {!something.js} {!something.css}
        replace_globals($o);
        // {!global} {!global}
        translate_parse($o);
        // {~rus} {~eng}
        die($o);
    }
    return $o;
}
Пример #3
0
function template($name = "", $varname1 = "", $varval1 = "", $varname2 = "", $varval2 = "", $varname3 = "", $varval3 = "")
{
    if (!$name) {
        $name = $GLOBALS['def_template'];
    }
    $php_template = $name . ".php.html";
    if (!file_exists($php_template)) {
        $php_template = "uses/" . $name . ".php.html";
    }
    if (!file_exists($php_template)) {
        $php_template = "views/" . $name . ".php.html";
    }
    if (file_exists($php_template)) {
        ob_start();
        foreach ($GLOBALS as $key => $value) {
            ${$key} = $value;
        }
        require $php_template;
        $contents = ob_get_contents();
        ob_end_clean();
        return $contents;
    }
    $dwoo_template = "uses/" . $name . ".dwoo.html";
    if (file_exists($dwoo_template)) {
        require_once "uses/dwoo/dwooAutoload.php";
        $dwoo = new Dwoo();
        $data = new Dwoo_Data();
        foreach ($GLOBALS as $key => $value) {
            $data->assign($key, $value);
        }
        $html = $dwoo->get($dwoo_template, $data);
        return $html;
    }
    $fname = "uses/" . $name . ".tmpl.html";
    if (!file_exists($fname)) {
        $fname = "uses/" . $name . ".html";
    }
    if (file_exists($fname)) {
        $html = file_get_contents($fname);
        template_set($html, $varname1, $varval1, $varname2, $varval2, $varname3, $varval3);
        replace_files($html);
        replace_my_tags($html);
        replace_globals($html);
        return $html;
    } else {
        die("template: {$name} not found");
    }
}
Пример #4
0
            break;
    }
}
$content = script_uses_head() . $content;
if (function_exists("before_content_post")) {
    before_content_post($content);
}
$pagename = $_GET['q'];
$pagename = str_replace(".", "", $pagename);
if (!$content && !$appropriate_function) {
    $content = "<h1>ERROR:<br> Can't render '" . $_GET['q'] . "'</h1>";
}
if (!isset($template)) {
    $template = file_get_contents("main.html");
}
if (function_exists("before_template_parse")) {
    before_template_parse($template);
}
/// SQP TEMPLATE ENGINE
replace_files($template);
// {!something.js} {!something.css}
replace_my_tags($template);
// {href {f {call
replace_globals($template);
// {!global} {!global}
translate_parse($template);
// {~rus} {~eng}
echo $template;
//don't show mysql not freed etc
ini_set("display_errors", 0);
ini_set("mysql.trace_mode", 0);
Пример #5
0
function template($name = "", $varname1 = "", $varval1 = "", $varname2 = "", $varval2 = "", $varname3 = "", $varval3 = "")
{
    if (!$name) {
        $name = $GLOBALS['def_template'];
    }
    $fname = "uses/" . $name . ".tmpl.html";
    if (!file_exists($fname)) {
        $fname = "uses/" . $name . ".html";
    }
    if (file_exists($fname)) {
        $html = file_get_contents($fname);
        template_set($html, $varname1, $varval1, $varname2, $varval2, $varname3, $varval3);
        replace_files($html);
        replace_my_tags($html);
        replace_globals($html);
        return $html;
    } else {
        die("template: {$name} not found");
    }
}