Ejemplo n.º 1
0
            $headtpl->SetVariable("titel", "Get Action wrong");
            $error_message = "Wrong GET action";
        }
        # no action, must be index-style
    } else {
        $entry = get_latest_article();
        if ($entry) {
            # head- titel setzen
            $headtpl->SetVariable("titel", $entry[title]);
            # main-template laden
            $tpl->loadTemplatefile("index.tpl.html", true, true);
            $tpl->SetVariable("titel", $entry[title]);
            $tpl->SetVariable("entry_id", $entry[entry_id]);
            $number_comments = get_number_of_comments($entry[entry_id]);
            $tpl->SetVariable("anz_kommentare", $number_comments[0]['COUNT(*)']);
            $tpl->SetVariable("artikel", $entry[artikel]);
            $tpl->SetVariable("date", $entry[date]);
            $tpl->SetVariable("text", nl2br($entry[text]));
        } else {
            $headtpl->SetVariable("titel", "Data not found");
            $error_message = "Data is not found. Bad.";
        }
    }
}
$headtpl->show();
if ($error_message != "") {
    echo $error_message;
} else {
    $tpl->show();
}
require "tpl/foot.tpl.html";
Ejemplo n.º 2
0
 /**
  * Reads a file from disk and returns its content.
  * @param string $page
  * @return string - parsed template
  */
 function show($page = '')
 {
     if (isset($page) && $page != '') {
         echo preg_replace_callback(EVAL_REG_EXP, 'tpl_eval', $page);
     } else {
         parent::show();
     }
     echo $this->makeDebug();
 }