本文整理汇总了PHP中Template::display方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::display方法的具体用法?PHP Template::display怎么用?PHP Template::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayTemplate
function displayTemplate($title, $template, $vars)
{
$t = new Template($title);
$t->display('header');
if (is_array($vars)) {
foreach ($vars as $var => $val) {
$t->assignVar($var, $val);
}
}
$t->display($template);
$t->display('footer');
}
示例2: index
function index()
{
include "header.php";
global $db, $lang, $prefix;
$tpl = new Template();
$tpl->modTemplate("package");
$continent = intval($_GET["continent"]);
if (!empty($continent)) {
$cond = " AND package_continent={$continent}";
}
$result = $db->query("SELECT * FROM " . $prefix . "_package WHERE package_active=1 {$cond}");
$num_record = $db->row_count($result);
if ($num_record < 1) {
$tpl->display("no_package.tpl");
include "footer.php";
exit;
}
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
$currentpage = $page;
$perpage = 20;
$start = ($page - 1) * $perpage;
$pages = ceil($num_record / $perpage);
$starting_no = $start + 1;
if ($num_record - $start < $perpage) {
$end_count = $num_record;
} elseif ($num_record - $start >= $perpage) {
$end_count = $start + $perpage;
}
if ($pages > 1) {
$page_link = makepagelink("index.php?m=package", $page, $pages);
} else {
$page_link = "";
}
$result2 = $db->query("SELECT * FROM " . $prefix . "_package WHERE package_active=1 {$cond} ORDER BY package_id DESC limit {$start},{$perpage}");
$tpl->assign("pagelink", $page_link);
$tpl->assign("start", $starting_no);
$tpl->assign("end", $end_count);
$tpl->assign("found", $num_record);
$tpl->assign("currentpage", $currentpage);
while ($row = $db->fetch_array($result2)) {
$package[] = $row;
}
$tpl->assign("lang", $lang);
$tpl->assign("package", $package);
$tpl->display("package.tpl");
include "footer.php";
}
示例3: detail
public function detail($targetid, $display = true)
{
$this->targetid = $targetid;
$sparams = array('id' => $this->targetid, 'block' => $this->module, 'contactid' => $_SESSION["loggeduser"]['id'], 'sessionid' => $_SESSION["loggeduser"]['sessionid']);
$lmod = $GLOBALS["sclient"]->call('get_details', $sparams);
//echo '<h2>request</h2><pre>' . htmlspecialchars($GLOBALS["sclient"]->response, ENT_QUOTES) . '</pre>';
foreach ($lmod[0][$this->module] as $ticketfield) {
$fieldlabel = $ticketfield['fieldlabel'];
$fieldvalue = $ticketfield['fieldvalue'];
$blockname = $ticketfield['blockname'];
if (!isset($mod_infos[$blockname])) {
$mod_infos[$blockname] = array();
}
$mod_infos[$blockname][] = array("label" => $fieldlabel, "value" => $fieldvalue);
}
$docs = $this->get_documents();
if (isset($docs) && count($docs) > 0) {
$mod_infos = array_merge($mod_infos, $docs);
}
$data['recordinfo'] = $mod_infos;
if ($display) {
Template::display($this->module, $data, 'detail');
} else {
return $mod_infos;
}
}
示例4: main
public static function main($tmplData)
{
//echo "Render::main()";
global $ini;
$tmplData['{{content}}'] = Template::render($ini['mainTemplate'], $tmplData);
Template::display($ini['layoutTemplate'], $tmplData);
}
示例5: formAction
/**
* Handle form action
*/
protected function formAction()
{
switch ($this->s->action) {
case 'reload':
// element: submenu
$this->s->resetParams('form');
$module = $this->s->loadModule($this->s->controller);
$tpl = new Template('system');
$tpl->assign('subnav', $this->generateNav($module->getSection()));
$tpl->display('submenu.html');
return true;
break;
case 'submenu':
if ($this->s->element == '') {
Error::addWarning('Fehler: ID des Untermenüs ist nicht definiert!');
return false;
}
$section = str_replace('nav_', '', $this->s->element);
$this->s->resetParams();
$tpl = new Template('system');
$tpl->assign('subnav', $this->generateNav($section));
$tpl->display('submenu.html');
return true;
break;
case 'cleanlog':
if ($this->s->element == 'error') {
$file = fopen("logs/error.log", "w+");
fclose($file);
}
return true;
break;
}
}
示例6: get_list
public function get_list()
{
$params = array('id' => $_SESSION["loggeduser"]['id'], 'type' => $GLOBALS["summary_widgets"]);
$result = $GLOBALS["sclient"]->call('get_summary_widgets', $params);
//echo '<h2>request</h2><pre>' . htmlspecialchars($GLOBALS["sclient"]->response, ENT_QUOTES) . '</pre>';
$data['widgets'] = $result != false && $result[0] != '' ? $result[0] : array();
Template::display($this->module, $data, 'index');
}
示例7: index
public function index()
{
$user = System::getUser();
$form = new Form('form-profile');
$form->setAttribute('data-noajax', 'true');
$form->binding = $user;
$fieldset = new Fieldset(System::getLanguage()->_('General'));
$firstname = new Text('firstname', System::getLanguage()->_('Firstname'));
$firstname->binding = new Databinding('firstname');
$lastname = new Text('lastname', System::getLanguage()->_('Lastname'));
$lastname->binding = new Databinding('lastname');
$email = new Text('email', System::getLanguage()->_('EMail'), true);
$email->binding = new Databinding('email');
$email->blacklist = $this->getListOfMailAdresses($user);
$email->error_msg[4] = System::getLanguage()->_('ErrorMailAdressAlreadyExists');
$language = new Radiobox('lang', System::getLanguage()->_('Language'), L10N::getLanguages());
$language->binding = new Databinding('lang');
$fieldset->addElements($firstname, $lastname, $email, $language);
$form->addElements($fieldset);
$fieldset = new Fieldset(System::getLanguage()->_('Password'));
$password = new Password('password', System::getLanguage()->_('Password'));
$password->minlength = PASSWORD_MIN_LENGTH;
$password->binding = new Databinding('password');
$password2 = new Password('password2', System::getLanguage()->_('ReenterPassword'));
$fieldset->addElements($password, $password2);
$form->addElements($fieldset);
$fieldset = new Fieldset(System::getLanguage()->_('Settings'));
$quota = new Text('quota', System::getLanguage()->_('Quota'));
if ($user->quota > 0) {
$quota->value = System::getLanguage()->_('QuotaAvailabe', Utils::formatBytes($user->getFreeSpace()), Utils::formatBytes($user->quota));
} else {
$quota->value = System::getLanguage()->_('Unlimited');
}
$quota->readonly = true;
$fieldset->addElements($quota);
$form->addElements($fieldset);
if (Utils::getPOST('submit', false) !== false) {
if (!empty($password->value) && $password->value != $password2->value) {
$password2->error = System::getLanguage()->_('ErrorInvalidPasswords');
} else {
if ($form->validate()) {
$form->save();
System::getUser()->save();
System::getSession()->setData('successMsg', System::getLanguage()->_('ProfileUpdated'));
System::forwardToRoute(Router::getInstance()->build('ProfileController', 'index'));
exit;
}
}
} else {
$form->fill();
}
$form->setSubmit(new Button(System::getLanguage()->_('Save'), 'floppy-disk'));
$smarty = new Template();
$smarty->assign('title', System::getLanguage()->_('MyProfile'));
$smarty->assign('heading', System::getLanguage()->_('MyProfile'));
$smarty->assign('form', $form->__toString());
$smarty->display('form.tpl');
}
示例8: index
function index()
{
global $site_path, $db, $prefix, $site_host, $config, $lang;
include "header.php";
$id = intval($_GET["id"]);
$tpl = new Template();
$tpl->modTemplate("package");
$result = $db->query("SELECT * FROM travel_package WHERE package_id={$id} AND package_active=1");
$row = $db->fetch_array($result);
$content = explode("<break>", "{$row['package_desc']}");
$num_record = count($content);
if (isset($_GET['page'])) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
$currentpage = $page;
$perpage = 1;
$start = ($page - 1) * $perpage;
$pages = ceil($num_record / $perpage);
$starting_no = $start + 1;
if ($num_record - $start < $perpage) {
$end_count = $num_record;
} elseif ($num_record - $start >= $perpage) {
$end_count = $start + $perpage;
}
if ($pages > 1) {
$page_link = makepagelink("index.php?m=package&file=packagedetails&id={$id}", $page, $pages);
} else {
$page_link = "";
}
$arrayelement = (int) $page;
$arrayelement--;
if (is_admin()) {
$link = "<a href=index.php?file=admin&op=editpackage&id={$row['package_id']}>Edit</a>";
} else {
$link = "";
}
$contentx = nl2br($content[$arrayelement]);
$q = $_SERVER["QUERY_STRING"];
$url = "{$config['site_url']}/index.php?{$q}";
$tpl->assign("phone", $config[site_phone]);
$tpl->assign("lang", $lang);
$tpl->assign("id", $id);
$tpl->assign("link", $url);
$tpl->assign("pagelink", $page_link);
$tpl->assign("start", $starting_no);
$tpl->assign("end", $end_count);
$tpl->assign("found", $num_record);
$tpl->assign("currentpage", $currentpage);
$tpl->assign("package", $row);
$tpl->assign("content", $contentx);
$tpl->display("package_details.tpl");
include "footer.php";
}
示例9: render
public function render($template, $_vars = array(), $fetch = false)
{
$tpl = new Template($template);
$this->addVars($_vars);
foreach ($this->vars as $key => $var) {
$tpl->assign($key, $var);
}
if ($fetch === true) {
return $tpl->fetch($tpl->getTemplate());
}
$tpl->display($tpl->getTemplate());
return true;
}
示例10: defaultRender
protected function defaultRender($responseObject)
{
$ref = new \ReflectionClass(get_class($responseObject));
$path = str_replace('.php', '/' . $this->request->getResponseMethod() . '.php', $ref->getFileName());
if (file_exists($path)) {
$content = new Template($path, $responseObject);
$layout = new Template($this->layout ?: $this->getDefaultLayout());
$layout->content = $content;
$layout->display();
return true;
}
return false;
}
示例11: render
public function render($tpl, array $vars = array(), $folder = '')
{
if (empty($folder)) {
$folder = $this->folder_tpl;
if (!empty($folder)) {
$folder = explode('\\', $folder);
$folder = end($folder);
$folder = str_replace('Controller', '', $folder);
$folder = strtolower($folder);
}
}
$smarty = new Template($this->path_tpl, $folder);
foreach ($vars as $key => $value) {
$smarty->assign($key, $value);
}
$smarty->display($tpl . '.tpl');
}
示例12: display
/**
* The display method that including caching.
*
* @return string
* @author Justin Palmer
**/
public function display()
{
//var_dump($this->Controller);
//If the cache type is null just return the template.
//Or, if the cache_type is not one of the supported cache_types
if ($this->view_path === null || !$this->Controller->pr_do_cache || !$this->isValidCacheType()) {
return parent::display();
}
//If it is a valid cache type then call the method and return the template view.
$cached = $this->Cache->isCached();
if ($cached !== false) {
return $this->Cache->get();
} else {
$content = parent::display();
$this->Cache->value = $content;
$this->Cache->cache();
return $content;
}
}
示例13: php
public function php()
{
parent::checkAuthentification();
parent::checkIfAdmin();
$entries = LogEntry::find('log', 'php');
if ($entries == NULL) {
$entries = array();
} else {
if ($entries instanceof LogEntry) {
$entries = array($entries);
}
}
usort($entries, array('LogEntry', 'compare'));
$smarty = new Template();
$smarty->assign('entries', $entries);
$smarty->assign('title', System::getLanguage()->_('Log'));
$smarty->assign('heading', System::getLanguage()->_('PHPEntries'));
$smarty->assign('showPHPEntries', true);
$smarty->display('log/log.tpl');
}
示例14: get_list
function get_list()
{
$allow_all = $GLOBALS["sclient"]->call('show_all', array('module' => $this->module));
if ($allow_all != 'true') {
$onlymine = "true";
}
$params = array(array('id' => $_SESSION["loggeduser"]['id'], 'sessionid' => $_SESSION["loggeduser"]['sessionid']));
$result = $GLOBALS["sclient"]->call('get_KBase_details', $params);
$data['faqcategories'] = array();
$data['faqcategories'] = $result[0];
$data['faqproducts'] = $result[1];
$data['faqs'] = $result[2];
$faqspercat = array();
if (isset($data['faqs']) && count($data['faqs']) > 0 && $data['faqs'] != "") {
foreach ($data['faqs'] as $faq) {
if (!isset($faqspercat[$faq["category"]])) {
$faqspercat[$faq["category"]] = array();
}
$params = array('id' => $faq["id"], 'module' => "Documents", 'contactid' => $_SESSION["loggeduser"]['id'], 'sessionid' => $_SESSION["loggeduser"]['sessionid']);
$resultb = $GLOBALS["sclient"]->call('get_documents', $params);
if (isset($resultb) && count($resultb) > 0 && $resultb != "") {
foreach ($resultb[1]['Documents']['data'] as $doc) {
$faq["attachments"][] = $doc;
}
}
$faqspercat[$faq["category"]][] = $faq;
}
}
$faqpr = array();
if (isset($data['faqproducts']) && count($data['faqproducts']) > 0 && $data['faqproducts'] != "") {
foreach ($data['faqproducts'] as $faqprod) {
if (!isset($faqpr[$faqprod["productid"]])) {
$faqpr[$faqprod["productid"]] = array();
}
$faqpr[$faqprod["productid"]] = $faqprod;
}
}
$data['faqs'] = $faqspercat;
$data['faqproducts'] = $faqpr;
Template::display($this->module, $data, 'list');
}
示例15: error
/**
* Send formatted error data
*/
public function error()
{
$error = $this->out;
// send HTTP header
if (!headers_sent()) {
header($_SERVER['SERVER_PROTOCOL'] . ' ' . $error->getCode());
header('Content-Type: text/html');
}
// display error
$template = new Template(Configuration::get('base_dir') . DS . 'templates' . DS . 'base.html');
$template->replace('base_url', Configuration::get('base_url'));
// make title
$title = $error->getCode() . ' Error';
$template->replace('title', $title);
// make body
$body = '<p><i>Message</i>: ' . $error->getMessage() . '</p>';
$body .= '<p><i>Code</i>: ' . $error->getCode() . '</p>';
$template->replace('content', $body);
// display
$template->display();
}