本文整理汇总了PHP中Template::Display方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::Display方法的具体用法?PHP Template::Display怎么用?PHP Template::Display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::Display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exitWithMessage
public static function exitWithMessage($message_detail, $forward_url, $second = 3, $type = "message")
{
switch ($type) {
case "success":
$page_title = "操作成功!";
break;
case "error":
$page_title = "错误!";
break;
default:
$page_title = "嗯!";
break;
}
$temp = explode('?', $forward_url);
$file_url = $temp[0];
if ($file_url[0] !== "/") {
$file_url = '/' . $file_url;
$forward_url = '/' . $forward_url;
}
$menu = MenuUrl::getMenuByUrl($file_url);
$forward_title = "首页";
if (sizeof($menu) > 0) {
$forward_title = $menu['menu_name'];
}
if ($forward_url) {
$message_detail = "{$message_detail} <script>setTimeout(\"window.location.href ='" . ADMIN_URL . "{$forward_url}';\", " . $second * 1000 . ");</script>";
}
Template::assign('type', $type);
Template::assign('page_title', $page_title);
Template::assign('message_detail', $message_detail);
Template::assign('forward_url', $forward_url);
Template::assign('forward_title', $forward_title);
Template::Display('message.tpl');
exit;
}
示例2: ActionDefault
public function ActionDefault()
{
$template = new Template();
switch ($this->action) {
case 'guide':
$template->title = 'Usenet Guide';
$template->body = new Template('help_guide');
break;
case 'faq':
$template->title = 'FAQ';
$template->body = new Template('help_faq');
break;
case 'contact':
$template->title = 'Contact';
$template->body = new Template('help_contact');
break;
default:
header('Location: ' . static::$config['url']['base']);
exit;
}
$template->title .= ' :: ';
$template->rss = static::$config['url']['rss'];
$template->searchbox = new Template('searchbox');
$template->menu = new Template('menu');
$template->Display('layout');
}
示例3: __construct
public function __construct()
{
require '../includes/config.inc.php';
$this->SetLanguage(ConfigHelper::Get('/languages/installed'));
// check validity of selected view (to prevent loading of other files from the filesystem)
if (isset($_REQUEST['view']) && preg_match("/^[a-z0-9_-]+\$/i", $_REQUEST['view']) && file_exists('../views/' . $_REQUEST['view'] . '.php')) {
// we now have a safe string
$this->sView = $_REQUEST['view'];
$this->sViewPath = '../views/' . $_REQUEST['view'] . '.php';
} elseif (empty($_REQUEST['view']) && file_exists('../views/home.php')) {
// look for default view
$this->sView = 'home';
$this->sViewPath = '../views/home.php';
} else {
// invalid request and no default view available - quit application
die('Invalid view specified.');
}
if (!in_array($this->sView, array('download'))) {
// instantiate translations
$oTranslations = new Translations($this->sLanguage, ConfigHelper::Get('/cache/translations_dir/'), ConfigHelper::Get('/translations/allow_show_keys'));
// instantiate layout template
if (ConfigHelper::Get('/template/paths')) {
$oTemplate = new Template('layout.php', $this->sLanguage, ConfigHelper::Get('/template/paths'));
} else {
$oTemplate = new Template('layout.php', $this->sLanguage);
}
// pass common data to template
$oTemplate->Set('appRoot', ConfigHelper::Get('/app_root'));
$oTemplate->Set('contactEmail', ConfigHelper::Get('/emails/contact'));
$oTemplate->Set('languages', ConfigHelper::Get('/languages/installed'));
$oTemplate->Set('language', $this->sLanguage);
$oTemplate->Set('missingTranslations', !in_array($this->sLanguage, ConfigHelper::Get('/languages/complete')));
$oTemplate->Set('languageSwitch', ConfigHelper::Get('/languages/switch'));
$oTemplate->Set('view', $this->sView);
$oTemplate->Set('template', $this->sView);
$oTemplate->Set('translation', $oTranslations);
$oTemplate->Set('assetsDir', ConfigHelper::Get('/assets_dir'));
// add content template
$oTemplate->Set('content', new Template("{$this->sView}.php", $this->sLanguage, ConfigHelper::Get('/template/paths')));
$oTemplate->Set('headerImageUrl', ConfigHelper::Get('/images/header/url'));
$oTemplate->Set('headerImageAlt', ConfigHelper::Get('/images/header/alt'));
$oTemplate->Set('headerImageWidth', ConfigHelper::Get('/images/header/width'));
$oTemplate->Set('headerImageHeight', ConfigHelper::Get('/images/header/height'));
$oTemplate->Set('headerHref', ConfigHelper::Get('/urls/header'));
$oTemplate->Set('reportBugUrl', ConfigHelper::Get('/urls/report_bug'));
$oTemplate->Set('viewsDir', '../views/');
$oTemplate->Set('toolUrl', str_replace(array('http://', 'https://'), '', ConfigHelper::Get('/urls/tool')));
// load view
require $this->GetViewPath();
// display resulting page
echo $oTemplate->Display();
} else {
// load view
require $this->GetViewPath();
}
}
示例4: RadioInput
public function RadioInput($sName, $sId, $sLabel, $vValue, $vDefault)
{
$oTemplate = new Template('radio-input.php', '', ConfigHelper::Get('/template/paths'));
$oTemplate->Set('name', $sName);
$oTemplate->Set('id', $sId);
$oTemplate->Set('label', $sLabel);
$oTemplate->Set('value', $vValue);
$oTemplate->Set('current', $this->GetCurrentValue($sName, $vDefault));
return $oTemplate->Display();
}
示例5: IncTemplate
protected function IncTemplate($sTemplate, $aVariables = array())
{
$oTemplate = new Template($sTemplate, $this->sLang, $this->aTemplatePaths);
$oTemplate->aVars = $this->aVars;
if (count($aVariables)) {
foreach ($aVariables as $sKey => $vValue) {
$oTemplate->set($sKey, $vValue);
}
}
echo $oTemplate->Display();
}
示例6: ActionDefault
public function ActionDefault()
{
$template = new Template();
$render = new RSSRender(static::$config['url']['rss']);
// Title
if (isset($_REQUEST['q']) && !empty($_REQUEST['q'])) {
$template->title = SafeHTML(trim($_REQUEST['q']));
} elseif (isset($_REQUEST['cat']) && !empty($_REQUEST['cat'])) {
$cat = trim($_REQUEST['cat']);
$template->title = SafeHTML($cat != 'dvd' ? ucfirst($cat) : strtoupper($cat));
} else {
$template->title = 'All';
}
$template->title .= ' :: ';
// RSS
$template->rss = 'http://' . static::$config['url']['domain'] . static::$config['url']['rss'];
if (count($render->link) > 0) {
$template->rss .= '?' . http_build_query($render->link, '', '&');
}
// Result
$template->items = $render->View();
$template->Display('layout_rss', 'text/xml');
}
示例7: exitWithMessage
public static function exitWithMessage($message_detail, $forward_url, $second = 3, $type = "message")
{
switch ($type) {
case "success":
$page_title = "操作成功!";
break;
case "error":
$page_title = "错误!";
break;
default:
$page_title = "嗯!";
break;
}
//var_dump($forward_url);exit;
$temp = explode('?', $forward_url);
$file_url = $temp[0];
if ($file_url[0] !== "/") {
$file_url = '/' . $file_url;
$forward_url = '/' . $forward_url;
}
$menu = MenuUrl::getMenuByUrl($file_url);
//var_dump($temp,$menu,$file_url);exit;
$forward_title = "首页";
if (sizeof($menu) > 0) {
$forward_title = $menu['menu_name'];
}
if ($forward_url) {
$message_detail = "{$message_detail}";
}
Template::assign('type', $type);
Template::assign('page_title', $page_title);
Template::assign('message_detail', $message_detail);
Template::assign('forward_url', $forward_url);
Template::assign('forward_title', $forward_title);
Template::Display('message.tpl');
exit;
}
示例8: LoggedOnly
die;
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/CreditShop.tpl.php")) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/LoggedOnly.class.php";
new LoggedOnly();
$tpl = new Template();
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
$db = new MuDatabase();
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
$acc = new Account($db);
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/CreditShop.class.php";
$cs = new CreditShop($db);
if (substr_count($_GET['c'], "/") > 0) {
$my_url = explode("/", $_GET['c']);
$action = $my_url[1];
} else {
$action = false;
}
$my_array['CreditShop'] = $cs->ShowPackageList($acc);
if (!$action) {
$my_array['Feedback'] = "";
} else {
$my_array['Feedback'] = $cs->BuyPackage($action, $db, $acc);
}
$my_array['CurrentBalance'] = $acc->Credits;
$db->Disconnect();
$tpl->Assign($my_array);
$tpl->Display("Templates/{$MainTemplate}/CreditShop.tpl.php");
} else {
echo "ERROR: File Templates/{$MainTemplate}/CreditShop.tpl.php doesnt exists";
}
示例9: _xStatsLoginShow
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
require_once 'lib/global.php';
require_once 'template.php';
require_once 'utility.php';
$functions = array('stats' => '_xStatsShow', 'forgot' => '_xForgotPasswordShow', 'remind' => '_xForgotPasswordConfirm', 'confirm' => '_xForgotPasswordConfirmed');
prepare_request();
$t = new Template();
$t->AssignByRef('g_config', $C);
$t->AssignByRef('g_request', $_REQUEST);
if (!$C['flag_allow_login']) {
$t->Display('trade-stats-disabled.tpl');
exit;
}
$r = $_REQUEST['r'];
if (isset($functions[$r])) {
call_user_func($functions[$r]);
} else {
_xStatsLoginShow();
}
function _xStatsLoginShow()
{
global $t, $C;
$t->Display('trade-stats-login.tpl');
}
function _xStatsShow()
{
示例10: ActionDefault
public function ActionDefault()
{
// If a _lot_ of NZB files are requested together, we might run out of memory
ini_set('memory_limit', '1024M');
$ids = array();
// Get post
if (isset($_POST['id']) && is_array($_POST['id'])) {
foreach ($_POST['id'] as $id) {
$id = intval($id);
if ($id > 0) {
$ids[$id] = $id;
}
}
} elseif (isset($this->params[0]) && (int) $this->params[0] > 0) {
$ids[(int) $this->params[0]] = (int) $this->params[0];
} else {
die('<b>Error</b>: invalid post specified.');
}
$nzb = '';
$template = new Template();
$template->body = '';
foreach ($ids as $id) {
try {
$post = Post::FindByID($id);
} catch (ActiveRecord_NotFoundException $e) {
die('<b>Error</b>: post ' . SafeHTML($id) . ' does not exist.');
}
// Updated time must be at least a minute ago, otherwise NZB cache may not be updated
if (file_exists(Post::NZBFile($post->id)) && $post->updated < time() - 60) {
$template->body .= file_get_contents(Post::NZBFile($post->id));
} else {
$template->body .= Post::NZB($post->id);
}
// NZB name is taken from first post in list
if (empty($nzb)) {
$nzb = Post::NZBName($post->subject);
}
// Don't try to download all BDMV raws in one go please
if (memory_get_peak_usage() > self::MEMORY_LIMIT) {
die('<b>Error:</b> out of memory. Please download fewer NZB files together.');
}
}
// If multiple posts in one NZB, remove numbers from NZB name
if (count($ids) > 1) {
$nzb = preg_replace('/\\s+\\d+\\.nzb$/i', '.nzb', $nzb);
$nzb = preg_replace('/\\s+\\d+\\s+/i', ' ', $nzb);
$nzb = preg_replace('/\\s+/i', ' ', $nzb);
}
header('Content-disposition: inline; filename="' . $nzb . '"');
// Output NZB file
$template->Display('layout_nzb', 'application/x-nzb', false);
// Count download(s)
if (isset($_SERVER['REMOTE_ADDR']) && !empty($_SERVER['REMOTE_ADDR'])) {
// We don't store actual IP, only MD5 of the IP (for privacy)
$ip = md5(strtolower(trim($_SERVER['REMOTE_ADDR'])));
foreach ($ids as $id) {
try {
$download = Download::Find(array('postid' => $id, 'userip' => $ip));
// Found = ignore (count downloads only once)
} catch (ActiveRecord_NotFoundException $e) {
// Not found = add
$download = new Download();
$download->postid = $id;
$download->userip = $ip;
$download->Save();
}
}
}
}
示例11: Account
$acc = new Account($db);
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/WebTrade.class.php";
$wt = new WebTrade($acc);
$my_array['WarningMessage'] = "";
$my_array['WebTradeContent'] = "";
if ($WebTradeSnoCheck && (!isset($_SESSION['sno__numb']) || $_SESSION['sno__numb'] === false)) {
$sno_tpl['url'] = $_SERVER['REQUEST_URI'];
if (!isset($_SESSION['sno__numb'])) {
$sno_tpl['Feedback'] = "";
} else {
if ($_SESSION['sno__numb'] === false) {
$sno_tpl['Feedback'] = $GenericMessage09;
}
}
$tpl->Assign($sno_tpl);
$tpl->Display("Templates/{$MainTemplate}/SNO.tpl.php");
} else {
if (!$WebTradeBlockCheck || $WebTradeBlockCheck && $acc->CheckBlockStatus($acc->memb___id) == 0) {
if (substr_count($_GET['c'], "/") > 0) {
$my_url = explode("/", $_GET['c']);
$action = $my_url[1];
if (isset($my_url[2])) {
$data = $my_url[2];
}
}
if (isset($action)) {
switch ($action) {
case "Sell":
if (isset($_POST['SellItem'])) {
$my_array['WebTradeContent'] = $wt->SendSellItem($db, $acc->memb___id);
} else {
示例12: _xRegisterShow
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
require_once 'lib/global.php';
require_once 'utility.php';
require_once 'template.php';
$functions = array('register' => '_xRegister', 'confirm' => '_xConfirmShow');
prepare_request();
$t = new Template();
$t->AssignByRef('g_config', $C);
$t->AssignByRef('g_request', $_REQUEST);
if (!$C['flag_accept_new_trades']) {
$t->Display('register-closed.tpl');
exit;
}
$r = $_REQUEST['r'];
if (isset($functions[$r])) {
call_user_func($functions[$r]);
} else {
_xRegisterShow();
}
function _xRegisterShow()
{
global $t, $C;
// Get trade rules
$t->Assign('g_trade_rules', file_get_contents(FILE_TRADE_RULES));
$t->Assign('g_trade_rules_array', file(FILE_TRADE_RULES));
// Categories
示例13: isset
<?php
include "init.php";
// index.php?link_type=(torrent|text|link)&infohash=B05930182B4FC941E73A4278FC612D154D5A822B
define("LINK_TYPE", isset($_GET['link_type']) ? $_GET['link_type'] : '');
define("LINK_INFOHASH", isset($_GET['infohash']) ? $_GET['infohash'] : '');
define("PAGE_ACTION", isset($_GET['page_action']) ? $_GET['page_action'] : "main");
if (LINK_TYPE == 'link') {
define("PAGE_URL", 'link');
} else {
define("PAGE_URL", isset($_GET['page_url']) ? $_GET['page_url'] : "start");
}
if (file_exists(_configs()->paths->torrents . LINK_INFOHASH . '.torrent') && preg_match("/^[0-F]{40}/i", LINK_INFOHASH)) {
if (LINK_TYPE == 'torrent' || LINK_TYPE == 'text' || LINK_TYPE == '') {
$file = file_get_contents(_configs()->paths->torrents . LINK_INFOHASH . '.torrent');
if (LINK_TYPE == 'text') {
header('Content-Disposition: attachment; filename="' . LINK_INFOHASH . '.txt"');
header('Content-Type: text/plain');
} else {
header('Content-Disposition: attachment; filename="' . LINK_INFOHASH . '.torrent"');
header('Content-Type: application/x-bittorrent');
}
die($file);
} else {
$tpl = new Template(_configs()->paths->template . 'template.php');
echo $tpl->Display();
}
} else {
$tpl = new Template(_configs()->paths->template . 'template.php');
echo $tpl->Display();
}
示例14: extract
$user_name = $password = $remember = $verify_code = '';
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
// 去掉验证码 if(strtolower($verify_code) != strtolower($_SESSION['osa_verify_code'])){
if (0) {
OSAdmin::alert("error", ErrorMessage::VERIFY_CODE_WRONG);
} else {
$user_info = User::checkPassword($user_name, $password);
if ($user_info) {
if ($user_info['status'] == 1) {
User::loginDoSomething($user_info['user_id']);
if ($remember) {
$encrypted = OSAEncrypt::encrypt($user_info['user_id']);
User::setCookieRemember(urlencode($encrypted), 30);
}
$ip = Common::getIp();
SysLog::addLog($user_name, 'LOGIN', 'User', UserSession::getUserId(), json_encode(array("IP" => $ip)));
Common::jumpUrl('panel/index.php');
} else {
OSAdmin::alert("error", ErrorMessage::BE_PAUSED);
}
} else {
OSAdmin::alert("error", ErrorMessage::USER_OR_PWD_WRONG);
SysLog::addLog($user_name, 'LOGIN', 'User', '', json_encode(ErrorMessage::USER_OR_PWD_WRONG));
}
}
}
Template::assign('_POST', $_POST);
Template::assign('page_title', '登入');
Template::Display('login.tpl');
示例15: Template
if (!isset($_SESSION['memb___id']) || !isset($_SESSION['memb__pwd'])) {
$my_array['tpldir'] = $MainSiteFolder . "Templates/{$MainTemplate}/";
$my_array['SiteFolder'] = $MainSiteFolder;
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Template.class.php";
$tpl = new Template();
$tpl->Assign($my_array);
$tpl->Display($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/modules/LoginAjax1.tpl.php");
} else {
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/MuDatabase.class.php";
$db = new MuDatabase();
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Account.class.php";
$acc = new Account($db);
$my_array['credits'] = $acc->Credits;
$my_array['messages'] = $acc->Messages;
$my_array['name'] = $acc->memb_name;
$my_array['vip_status'] = $GenericMessage04 . $acc->VIP_Name;
$my_array['due_date'] = $GenericMessage05 . $acc->VIP_DueDate;
$db->Query("SELECT idx FROM Z_Currencies");
$NumRows = $db->NumRows();
for ($i = 0; $i < $NumRows; $i++) {
$ArrayCurrencies[$i] = $db->GetRow();
}
for ($i = 0; $i < $NumRows; $i++) {
$my_array["Credit_" . $ArrayCurrencies[$i]['idx']] = number_format($acc->GetCreditAmount($acc->memb___id, $ArrayCurrencies[$i]['idx'], $db), 0, ",", ".");
}
$db->Disconnect();
require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "System/Template.class.php";
$tpl = new Template();
$tpl->Assign($my_array);
$tpl->Display($_SERVER['DOCUMENT_ROOT'] . "/" . $_SESSION['SiteFolder'] . "Templates/{$MainTemplate}/modules/LoginAjax2.tpl.php");
}