public static function entry($args) { if( count($args) > 1 ) echo 404; else{ $post = ModelHandler::get("Posts", array($args[0])); $post = $post[0]; $content = ViewHandler::wrap("post", $post); $tpl = new TPL(); $tpl->assign("content",$content); $tpl->draw("main"); } }
function show_404() { // do programmed events EVENTS::do_action("on_error_404"); // change header status header("HTTP/1.0 404 Not Found"); // change title if isn't setted if (TPL::thing("head", "title") == '') { TPL::thing("head", "title", "Error 404 | Page not found"); } // set render and draw if (TPL::check_template("page_404")) { TPL::render("page_404"); TPL::draw(true); } else { echo "<h1>Error 404! Not found</h1>"; } }
/** * Send an email with selected template */ function email_tpl_send($template = "generic/email", $to, $subject, $body, $from = null, $from_name = null, $attachment = null) { $tpl = new TPL(); $tpl->assign("body", $body); $body = $tpl->draw($template, true); return emailSend($to, $subject, $body, $from, $from_name, $attachment); }
} // general assign TPL::assign("admin_url", ADMIN_URL); TPL::assign("base_url", BASE_URL); // run plugins foreach (DRAWLINE::plugins_list(true) as $plugin) { if (file_exists(FOLDER_PLUGINS . $plugin . DS . "index.php")) { include_once FOLDER_PLUGINS . $plugin . DS . "index.php"; EVENTS::do_action("run_plugin_" . $plugin); } else { LOGS::write("Not found plugin " . $plugin . " on the server."); } } EVENTS::do_action("before_render"); // start render if (OPTIONS::website("maintenance_mode") == '1' && !on_admin() && !PERMISSIONS::check("access_admin")) { if (TPL::check_template("page_maintenance")) { TPL::render("page_maintenance"); TPL::draw(true); } else { echo '<h1>This website is in maintenance!</h1>'; } } elseif (TPL::render() != "") { TPL::draw(true); } else { if (!URL::routed()) { show_404(); } } EVENTS::do_action("after_render"); //print_array(LOGS::export("html"));