function __construct() { parent::__construct(); $this->model = new mHome(); $this->view = new vHome(); $this->tpl = Template::Load("Home"); }
/** * Function used to draw a menu * * @param string $name The identifier of the menu */ static function Draw($name) { $menu = Cache::Read('menus/' . $name); if (!$menu) { if (Database::Exists(LWC::QUERY_MENU, [':name', $name])) { $menu = Database::Data(); if (Database::Fetch(LWC::QUERY_MENU_ITEMS, [':menu', $menu['id'], PDO::PARAM_INT])) { foreach (Database::Data() as $item) { if (Database::Fetch(LWC::QUERY_MENU_SUBITEMS, [[':parent', $item['id'], PDO::PARAM_INT], [':menu', $menu['id'], PDO::PARAM_INT]])) { foreach (Database::Data() as $subitem) { $item['subitems'][] = $subitem; } } $menu['items'][] = $item; } } Cache::Write('menus/' . $name, $menu); } else { return; } } if (session('rank') >= $menu['minrank'] && session('rank') <= $menu['maxrank']) { Template::Load('menu/navbar', $menu); } }
function DisplayForums() { $boards = $this->database->select("*", "subboards", array("refid" => "='" . (isset($_GET["refboard"]) ? $_GET["refboard"] : "") . "'")); $template = new Template("board.tpl.html", array()); while ($board = $this->database->fetch_array($boards, "assoc")) { $template->tpl_vars = array("name" => $board["name"], "description" => $board["description"], "link" => $board["refboard"] != "" ? $board["refbaord"] : "TODO - Display Threads"); $template->Load(); } }
public function template() { $col_name = "entry_template_id"; $template = null; if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) { $template_id = $this->{$col_name}; require_once 'class.mt_template.php'; $template = new Template(); $template->Load("template_id = {$template_id}"); } return $template; }
public function load_special_template($ctx, $tmpl, $type, $blog_id = null) { if (empty($blog_id)) { $blog_id = $ctx->stash('blog_id'); } $tmpl_name = $this->escape($tmpl); $where = "template_blog_id = {$blog_id}"; if (!empty($tmpl)) { $where .= " and (template_name = '{$tmpl_name}'\n or template_outfile = '{$tmpl_name}'\n or template_identifier='{$tmpl_name}')"; } $where .= " and template_type = '" . $this->escape($type) . "'"; require_once 'class.mt_template.php'; $template = new Template(); $template->Load($where); return $template; }
} else { if ($item['type'] == 'dropdown') { $item['active'] = false; if (isset($item['subitems'])) { foreach ($item['subitems'] as $key => $subitem) { if (isset($page['key']) && $subitem['key'] == $page['key']) { $item['active'] = true; $item['subitems'][$key]['active'] = true; } else { $item['subitems'][$key]['active'] = false; } $item['subitems'][$key] = at($item['subitems'][$key], ['name']); } } $item = at($item, ['name']); Template::Load('menu/dropdown', $item); } } } // TODO /* else if($item['type'] == 3) include(TEMPLATE_DIR . 'menu/divider.php'); else if($item['type'] == 4) { $subitems = $item['subitems']; include(TEMPLATE_DIR . 'menu/form.php'); } */ }
?> > <ul class="nav <?php if ($_PARAMS['justified']) { echo 'nav-justified'; } else { echo 'navbar-nav'; } ?> "> <?php if ($_PARAMS['gototop']) { Template::Draw('menu/gototop'); } $_PARAMS['alignment'] = 'left'; Template::Load('menu/items', $_PARAMS); ?> </ul> <ul class="nav navbar-nav navbar-right"> <?php $_PARAMS['alignment'] = 'right'; Template::Load('menu/items', $_PARAMS); ?> </ul> </div> <?php if (!$_PARAMS['justified']) { echo '</div>'; } ?> </nav>
"> <head> <?php Template::Load('page/head'); ?> </head> <?php flush(); ?> <body> <?php Template::Load('page/jsvars'); Template::Load('page/loader'); Menu::Draw('navigation'); Template::Load('page/notifications'); ?> <div id="wrapper"> <?php Template::Load('page/warnings'); ?> <div id="page"> <?php require dirname(__FILE__) . '/handler.php'; ?> </div> </div> <?php Menu::Draw('footer'); ?> </body> </html>
continue; } /* Es kann passieren, dass ein Modul 2x auf einer Seite geladen wird, deshalb wird es nur inkludiert, wenn die Klasse für das Modul noch nicht existiert */ if (!class_exists($module["class"])) { include MOD_DIR . $module["file"]; } /* Ausgabe unterdrücken */ ob_start(); $content = new $module["class"](); /* Instanz von der Modulklasse laden */ $content->database = $this->database; /* Datenbankobjekt übergeben ans Modul ---- TODO ----- */ $content->Run(); /* Modul ausführen */ $this->{$module["name"]} .= ob_get_contents(); /* Ausgaben an den Platzhalten hinzufügen */ ob_end_clean(); /* Ausgabenpuffer löschen */ } } } $id = isset($_GET["id"]) ? ctype_digit($_GET["id"]) ? $_GET["id"] : 1 : "1"; $template = new Template(); $template->database = new database("mysql", "localhost", "root", "passwort", "rockboard", true); # bestens $template->setContentFromDatabase($id); $template->Load("testTemplate.php"); /* Danke */