本文整理汇总了PHP中Template::output方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::output方法的具体用法?PHP Template::output怎么用?PHP Template::output使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: previewForm
static function previewForm($formData)
{
$form = new Template($formData, "test1uploadpreview.tpl", false);
$form->encode = false;
$form->output();
return $form->output;
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: display
function display()
{
$host = Settings::getInstance()->get("host");
$template = new Template();
$template->load("dashboard");
$template->assign_var("COLUMNS", $this->getColumnsCode());
$template->output();
}
示例6: show
public function show()
{
// $url = '';
// $request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
// $script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
// // Get our url path and trim the / of the left and the right
// if ($request_url != $script_url) {
// $url = trim(preg_replace('/' . str_replace('/', '\/', str_replace('index.php', '', $script_url)) . '/', '',
// $request_url, 1), '/');
// }
// $url = preg_replace('/\?.*/', '', $url); // Strip query string
$url = explode('/', $_SERVER['REQUEST_URI']);
if (count($url) == 4) {
$urldir = escape($url[count($url) - 2]);
$url = escape($url[count($url) - 1]);
} else {
$urldir = "";
$url = escape($url[count($url) - 1]);
}
/*
* TODO sjekk REQUEST_URI for antall. Hvis X, så betyr det at det er en subpost
*/
/*
* TODO eller... fortsett som før og bare list X category posts i get_pages()
*/
if ($url && $urldir) {
$file = SCORPION_DIR_CONTENT . $urldir . '/' . $url;
} elseif ($url) {
if ($url == strtolower($this->get_config('index'))) {
$file = SCORPION_DIR_CONTENT . 'index';
} elseif (strstr($url, 'admin')) {
Redirect::to(SCORPION_DIR_ADMIN . 'index.php');
die;
} else {
$file = SCORPION_DIR_CONTENT . $url;
}
} else {
$file = SCORPION_DIR_CONTENT . 'index';
}
if (is_dir($file)) {
$file = SCORPION_DIR_CONTENT . $url . '/index' . SCORPION_CONTENT_EXT;
} else {
$file .= SCORPION_CONTENT_EXT;
}
if (file_exists($file)) {
$content = file_get_contents($file);
} else {
$content = file_get_contents(SCORPION_DIR_CONTENT . '404' . SCORPION_CONTENT_EXT);
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
}
$navigation = $this->generate_navigation();
$meta = $this->read_file_meta($content);
$content = $this->parse_content($content);
$website = new Template($this->get_theme_path());
$codes = array('header_title' => $this->get_config('header_title'), 'header_slogan' => $this->get_config('header_slogan'), 'meta' => $meta, 'content' => $content, 'navigation' => $navigation, 'comments' => "--Comments--", 'addcomment' => "--Add comment--", 'theme_path' => $this->get_theme_path(), 'theme_url' => $this->base_url() . '/' . basename(SCORPION_DIR_THEMES) . '/' . $this->get_config('theme'), 'base_url' => $this->base_url(), 'visitor' => $_SERVER['REMOTE_ADDR'], 'date' => date("d.m.Y H:i:s"), 'date_year' => date("Y"));
$website->set($codes);
$website->output();
}
示例7: render
/**
* Prints the page based on a data array and a template file
* @param string the name of the template to use
* @param array an array of data for the template engine
* @return string
* @access public
*/
function render($file, $data = '')
{
require_once 'template.class.php';
$template = new Template('templates/' . $file);
if (is_array($data)) {
$template->replaceTags($data);
}
return $template->output();
}
示例8: displayLogOffScreen
/**
* Display screen shown on logging off
* @param SSP_template $tpl - main template
* @param string $userId - user id of memeber logging off
* @param string $returnPage - url of previous page
*/
public function displayLogOffScreen($tpl, $userId, $returnPage)
{
// displays the logoff screen
//
// parameters
// $tpl - object - main template object
$content = array("homePath" => $this->cfg->siteRoot, "logonPath" => $returnPage, "title" => "Logged off");
$logoff = new Template($content, "logoff.tpl");
$tpl->setData("content", $logoff->output());
return $tpl->output();
}
示例9: render
function render($view = false)
{
// get the page details stored in the database
$this->requestAllPages();
// define the rendering template
if (!$this->data['template']) {
$this->data['template'] = LISTINGS_TEMPLATE;
}
// display the page
Template::output($this->data);
}
示例10: view
public function view($file, $data = array())
{
$view = $this->dir . DS . 'Views' . DS . $file . '.phtml';
$profile = new Template($view);
foreach ($data as $key => $assign) {
$profile->set($key, $assign);
}
//$layout = new Template($this->dir .DS."layout".DS."layout.phtml");
//$layout->set("content", $profile->output());
echo $profile->render($profile->output());
// return $view->render();
}
示例11: display
public function display()
{
$language = new Language($_GET['language']);
if (isset($_POST['translation'])) {
$language->updateTranslation($_GET['token'], $_POST['translation']);
Cache::clear("language");
}
$template = new Template();
$template->load("translationtokeneditor");
$template->assign_var("ORIGINAL", Language::DirectTranslate($_GET['token']));
$template->assign_var("TRANSLATION", $language->getString($_GET['token']));
$template->output();
}
示例12: display
public function display()
{
$userlist = new Template();
$userlist->load("user_list");
$userlist->assign_var("URL", $this->page->GetUrl());
if (isset($_POST['insert'])) {
$user = new User();
$user->name = $_POST['name'];
$user->role = $_POST['new_user_role'];
$user->email = $_POST['email'];
if (!$user->insert($_POST['password'])) {
$userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_CREATED"));
}
}
if (isset($_GET['delete'])) {
$user = new User();
$user->id = $_GET['delete'];
if (!$user->delete()) {
$userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_DELETED"));
}
}
$userlist->assign_var("MSG", "");
Cache::clear("tables", "userlist");
$table = new Table();
$id = new TableColumn("id", Language::DirectTranslate("ID"));
$id->autoWidth = true;
$name = new TableColumn("name", Language::DirectTranslate("NAME"));
$role = new TableColumn("role", Language::DirectTranslate("ROLE"), "IFNULL((SELECT name FROM {'dbprefix'}roles WHERE id = {'dbprefix'}user.role),'')");
$email = new TableColumn("email", Language::DirectTranslate("EMAIL"));
$created = new TableColumn("create_timestamp", Language::DirectTranslate("CREATED_ON"));
$created->autoWidth = true;
$access = new TableColumn("last_access_timestamp", Language::DirectTranslate("LAST_ACCESS"));
$access->autoWidth = true;
$table->columns->add($id);
$table->columns->add($name);
$table->columns->add($role);
$table->columns->add($email);
$table->columns->add($created);
$table->columns->add($access);
$table->name = "{'dbprefix'}user";
$table->actions = "userlist";
$table->orderBy = "name";
$table->cacheName = "userlist";
$userlist->assign_var("TABLE", $table->getCode());
$roles = new RoleSelector();
$roles->hideSpecialRoles = true;
$roles->name = "new_user_role";
$userlist->assign_var("ROLES", $roles->getCode());
$userlist->output();
}
示例13: display
public function display()
{
$template = new Template();
$template->load("message");
if (ImageServer::insert($_POST['path'], $_POST['name'], $_POST['description'])) {
$template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_ADDED"));
$redirect = UrlRewriting::GetUrlByAlias("admin/home", "dir=" . urlencode($_SESSION['dir']));
if (isset($_POST['referrer'])) {
$redirect = $_POST['referrer'];
}
echo "<script type='text/javascript'>setTimeout('window.location.href= \\'" . $redirect . "\\'', 1000)</script>";
} else {
$template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_NOT_ADDED"));
}
$template->output();
}
示例14: 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();
}
示例15: output
public function output($data = null, $document = false)
{
$locale = $this->getLocale();
$data = new Hook\DataFunction(new \SplObjectStorage(), $data, $locale, $this->baseDir);
$headers = [];
$this->registerProperties($this->getBasicProperties($data, $locale, $headers));
//To be a valid XML document it must have a root element, automatically wrap it in <template> to ensure it does
$template = new Template($this->isFile ? $this->template : '<template>' . $this->template . '</template>');
$rules = (new Sheet($this->tss, $this->baseDir, $template->getPrefix()))->parse();
foreach ($rules as $rule) {
$hook = new Hook\Rule($rule->properties, new Hook\PseudoMatcher($rule->pseudo, $data), $data);
foreach ($this->registeredProperties as $properties) {
$hook->registerProperties($properties);
}
$template->addHook($rule->query, $hook);
}
$output = $template->output($document);
return (object) ['headers' => $headers, 'body' => $output];
}