本文整理汇总了PHP中Template::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::load方法的具体用法?PHP Template::load怎么用?PHP Template::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public static function index()
{
return function ($request, $response) {
$tpl = Template::load('register.html');
echo $tpl->render(array());
};
}
示例2: displayError
public function displayError()
{
if (!ini_get('display_errors')) {
return;
}
$messages = explode("\n", $this->message);
$messages = array_map('trim', $messages);
$messages = array_filter($messages, 'strlen');
$messages = array_values($messages);
$param = array("code" => $this->code, "messages" => $messages, "file" => $this->file, "line" => $this->line, "trace" => debug_backtrace());
$template = new Template();
// set template
$template->assign_vars($param);
// load template
if (!self::$template_filename) {
self::$template_filename = dirname(__FILE__) . '/../../component/view/Exception.tpl';
}
if ($template->load(self::$template_filename)) {
$html = $template->get_display_template(true);
} else {
throw new PMPException('Sysmtem Error ' . __CLASS__ . ' ' . __LINE__);
}
print $html;
exit;
}
示例3: Related_Terms
static function Related_Terms($attributes = Null)
{
$attributes = Is_Array($attributes) ? $attributes : array();
$attributes = Array_Merge(array('number' => 5), $attributes);
$related_terms = Core::getTagRelatedTerms($attributes);
return Template::load('glossary-related-terms.php', array('attributes' => $attributes, 'related_terms' => $related_terms));
}
示例4: display
public function display()
{
$rolelist = new Template();
$rolelist->load("role_list");
$actions = ActionList::get("rolelist");
if (isset($_POST['insert'])) {
$role = new Role();
$role->name = $_POST['insert'];
$role->insert();
}
if (isset($_GET['delete'])) {
$role = new Role();
$role->ID = $_GET['delete'];
$role->delete();
}
$table = new Table();
$id = new TableColumn("id", Language::DirectTranslate("ID"));
$id->autoWidth = true;
$name = new TableColumn("name", Language::DirectTranslate("NAME"));
$table->columns->add($id);
$table->columns->add($name);
$table->name = "{'dbprefix'}roles";
$table->actions = "rolelist";
$table->orderBy = "name";
$table->cacheName = "rolelist";
$rolelist->assign_var("TABLE", $table->getCode());
$rolelist->output();
}
示例5: view
public function view($name)
{
$template = new Template();
$template->load($name);
$this->template = $template;
return $this;
}
示例6: display
public function display()
{
$template = new Template();
$template->load("plugin_contactform_contactform");
$template->show_if('SHOWFORM', true);
$template->show_if('SHOWMESSAGE', false);
if (isset($_POST["contactformsubmit"]) && $_POST["url"] == "" && $_POST["inputspamcontrol"] == $_SESSION["plugin_contactform_result"]) {
$settings = Settings::getRootInstance()->specify("plugin", "contactform");
$plugin_contactform_receiver = $settings->get("contactform_mail");
$plugin_contactform_sendername = $_POST['inputname'];
$plugin_contactform_sendermail = $_POST['inputmail'];
$plugin_contactform_text = $_POST['inputtext'];
$plugin_contactform_subject = Language::DirectTranslate("plugin_contactform_pagetypetitle") . " " . Settings::getInstance()->get("title");
mail($plugin_contactform_receiver, $plugin_contactform_subject, $plugin_contactform_text, "From: {$plugin_contactform_sendername} <{$plugin_contactform_sendermail}>");
$_SESSION['plugin_contactform_result'] = "";
$template->show_if('SHOWFORM', false);
$template->show_if('SHOWMESSAGE', true);
$template->assign_var("SUCCESSMESSAGE", $settings->get("contactform_successmessage"));
}
$plugin_contactform_numberone = rand(1, 10);
$plugin_contactform_numbertwo = rand(1, 10);
$_SESSION['plugin_contactform_result'] = $plugin_contactform_numberone + $plugin_contactform_numbertwo;
$template->assign_var('FORMURL', UrlRewriting::GetUrlByAlias($this->page->alias));
$template->assign_var('NUMBER1', $plugin_contactform_numberone);
$template->assign_var('NUMBER2', $plugin_contactform_numbertwo);
Cache::clear();
echo $template->getCode();
}
示例7: display
public function display()
{
$template = new Template();
$template->load("plugins");
$plugins = new PluginList();
$plugins->loadAll();
foreach ($plugins->plugins as $plugin) {
$index = $template->add_loop_item("PLUGINS");
if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) {
$plugin->activate();
} elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) {
$plugin->deactivate();
}
$template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name));
$template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path));
$template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription()));
$template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version);
$template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink);
$template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName));
$template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license));
$template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl));
if ($plugin->isActivated()) {
$myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path));
$disable = Language::DirectTranslateHtml("DISABLE");
$template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>");
} else {
$myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path));
$enable = Language::DirectTranslateHtml("ENABLE");
$template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>");
}
}
$template->assign_var("HOST", Settings::getValue("host"));
$template->assign_var("APIKEY", Settings::getValue("apikey"));
$template->output();
}
示例8: upload
protected function upload()
{
$template = new Template();
$template->load("upload");
$template->assign_var("REFERRER", $_POST['referrer']);
$template->show_if("SHOW_MEDIALIBARY", false);
if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) {
mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']);
}
if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) {
$name = $_FILES['file']['name'];
$template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED")));
$path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) {
$template->show_if("SHOW_MEDIALIBARY", true);
$template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage"));
$template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name);
}
} else {
if (FileServer::$uploadFailure != "") {
$template->assign_var("MESSAGE", FileServer::$uploadFailure);
} else {
$template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED"));
}
}
$template->output();
}
示例9: load
public function load()
{
$this->headline = Language::DirectTranslate("plugin_menulistwidget_menus");
if (Cache::contains("menu", "widget_" . $_GET['dir'])) {
$this->content = Cache::getData("menu", "widget_" . $_GET['dir']);
} else {
if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
$_GET['dir'] = "";
}
$template = new Template();
$template->load("plugin_menulistwidget_menulist");
$newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu");
$template->assign_var("NEWMENUURL", $newmenuurl);
$menus = sys::getMenues($_GET['dir']);
foreach ($menus as $menu) {
$index = $template->add_loop_item("MENUS");
$template->assign_loop_var("MENUS", $index, "ID", $menu->id);
$template->assign_loop_var("MENUS", $index, "TITLE", $menu->name);
$template->assign_loop_var("MENUS", $index, "PAGES", $menu->count);
$editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id);
$template->assign_loop_var("MENUS", $index, "EDITURL", $editurl);
$deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id);
$template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl);
}
if (!$menus) {
$template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus"));
} else {
$template->assign_var("NOMENUS", "");
}
$this->content = $template->getCode();
Cache::setData("menu", "widget_" . $_GET['dir'], $this->content);
}
}
示例10: display
public function display()
{
$template = new Template();
$template->load("plugin_changepassword_changepassword");
$template->show_if('PASSWORD_WRONG', false);
$template->show_if('SUCCESSFUL', false);
$template->show_if('OLD_PASSWORD_WRONG', false);
if (isset($_REQUEST['old_password']) && !empty($_REQUEST['old_password']) && is_string($_REQUEST['old_password']) && isset($_REQUEST['new_password']) && !empty($_REQUEST['new_password']) && is_string($_REQUEST['new_password']) && isset($_REQUEST['confirm_password']) && !empty($_REQUEST['confirm_password']) && is_string($_REQUEST['confirm_password'])) {
$old_password = DataBase::Current()->EscapeString($_REQUEST['old_password']);
$new_password = DataBase::Current()->EscapeString($_REQUEST['new_password']);
$confirm_password = DataBase::Current()->EscapeString($_REQUEST['confirm_password']);
if ($new_password != $confirm_password) {
$template->show_if('PASSWORD_WRONG', true);
} else {
$password = DataBase::Current()->EscapeString(md5($new_password . Settings::getInstance()->get("salt")));
$old_password = DataBase::Current()->EscapeString(md5($old_password . Settings::getInstance()->get("salt")));
$db_password = DataBase::Current()->ReadField("SELECT `password` FROM `{'dbprefix'}user` WHERE `id` = '" . User::Current()->id . "'; ");
if ($db_password && $db_password != null) {
if ($db_password != $old_password) {
$template->show_if('OLD_PASSWORD_WRONG', true);
} else {
DataBase::Current()->Execute("UPDATE `{'dbprefix'}user` SET `password` = '" . $password . "' WHERE `id` = '" . User::Current()->id . "'; ");
$template->show_if('SUCCESSFUL', true);
EventManager::raiseEvent("plugin_changepassword_change", array('old_password' => $old_password, 'new_password' => $password, 'userid' => User::Current()->id));
Cache::clear("tables", "userlist");
}
} else {
//Der User ist nicht in der Datenbank aufgeführt.
}
}
}
$template->assign_var('ACTION', UrlRewriting::GetUrlByAlias($this->page->alias));
echo $template->getCode();
}
示例11: __construct
function __construct($contents)
{
$this->reg = Registry::getInstance();
//access to app_data
$array_app = (array) $this->reg->app_data;
Template::load($contents, $array_app);
}
示例12: getCode
/**
*
* @return string
*/
public function getCode()
{
if (isset($_POST['save'])) {
foreach ($_POST as $property => $value) {
if ($property != "save" && $property != "roles") {
$settings = Settings::getRootInstance()->specify($this->areaType, $this->area);
if ($this->dir != "" && $this->dir != "/") {
$settings = $settings->dir($this->dir);
}
$settings->set($property, $value, $this->role);
}
}
Settings::forceReload();
Cache::clear();
Language::GetGlobal()->ClearCache();
if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) {
exit;
} else {
die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>");
}
$changed = true;
}
$template = new Template();
$template->load($this->template);
if ($this->area != "global" || $this->areaType != "global") {
$roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
} else {
$roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">";
}
$roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name");
if ($roles) {
foreach ($roles as $role) {
if ($this->role == $role->id) {
$roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>";
} else {
$roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>";
}
}
}
$roleselector .= "</select>";
$template->assign_var("ROLES", $roleselector);
if ($this->area != "global" || $this->areaType != "global") {
$template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1");
} else {
$template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1");
}
$rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role);
if ($rows) {
foreach ($rows as $row) {
$index = $template->add_loop_item("SETTINGS");
$template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']);
$template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description']));
$control = new $row['type']();
$control->name = $row['name'];
$control->value = $row['value'];
$template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode());
}
}
return $template->getCode();
}
示例13: display
public function display()
{
$template = new Template();
if (!isset($_GET['delete'])) {
$template->load("menu_delete");
$template->assign_var("CANCELURL", "javascript:history.back()");
$template->assign_var("DELETEURL", $this->page->GetUrl("menu=" . urlencode($_GET['menu']) . "&delete=true"));
} else {
$template->load("message");
if (Menu::delete(DataBase::Current()->EscapeString($_GET['menu']))) {
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_DELETED"));
} else {
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_DELETED"));
}
}
$template->output();
}
示例14: printFilter
static function printFilter($filter_depth = False)
{
$prefix_filter = self::generate($filter_depth);
if (!empty($prefix_filter)) {
echo Template::load('glossary-prefix-filter.php', array('filter' => $prefix_filter));
} else {
return False;
}
}
示例15: index
/**
* inint index
*/
public function index()
{
// ถ้าไม่มีโมดูลเลือกหน้า home
$module = empty($_GET['module']) ? 'home' : $_GET['module'];
// สร้าง View
$view = $this->createView('Index\\Index\\View');
// template default
$view->add(array('MENU' => createClass('Index\\Menu\\Controller')->render($module), 'TITLE' => 'Welcome to GCMS++', 'CONTENT' => \Template::load('', '', $module), 'TIME' => \Date::format()));
// output เป็น HTML
$view->renderHTML();
}