本文整理汇总了PHP中tpl_display函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_display函数的具体用法?PHP tpl_display怎么用?PHP tpl_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_display函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderLayout
/**
* Assign content and render layout
*
* @param string $layout_path Path to the layout file
* @param string $content Value that will be assigned to the $content_for_layout
* variable
* @return boolean
* @throws FileDnxError
*/
function renderLayout($layout_path, $content = null)
{
tpl_assign('content_for_layout', $content);
return tpl_display($layout_path);
}
示例2: errorpage
// really shouldn't happen
if (empty($user_id)) {
errorpage('Access denied', 'You don\'t have enough permissions to access this ' . 'page. Please <a href="login.php">login</a> first. ' . '(This feature is not available in Single User Mode)');
}
// save data
if ($save) {
// convert languages array back into string
$languageflags = @join('::', $languages);
// insert data
foreach ($SETUP_USER as $opt) {
$SQL = "REPLACE INTO " . TBL_USERCONFIG . " (user_id, opt, value) \n VALUES ('" . addslashes($user_id) . "', '{$opt}', '" . addslashes(${$opt}) . "')";
runSQL($SQL);
}
// update session variables
update_session();
// reload config
load_config(true);
/*
// clear compiled templates for new template
AG: should not be required
$smarty->clear_compiled_tpl(null, $config['cacheid']);
*/
}
// prepare options
$setup = setup_mkOptions(true);
// prepare templates
tpl_page('profile');
$smarty->assign('setup', $setup);
// display templates
tpl_display('profile.tpl');
示例3: runSQL
// Check that user entered stuff in username and password boxes
if (!empty($username) && !empty($password)) {
// Lets check the format of username to make sure its ok
if (!preg_match('/[a-z]/i', $username)) {
$error = $lang['msg_invalidchar'];
} else {
$res = runSQL("SELECT passwd, id FROM " . TBL_USERS . " WHERE name='{$username}'");
// if the md5 of the entered password = whats in the database then
// set all the cookies up again
if (md5($password) == $res[0]['passwd']) {
$userid = $res[0]['id'];
login_as($userid, $permanent);
$login = true;
} else {
$error = $lang['msg_loginfailed'];
}
}
}
if ($login) {
if (empty($refer)) {
$refer = 'index.php';
}
redirect(urldecode($refer));
} else {
// prepare templates
tpl_page('multiuser');
$smarty->assign('error', $error);
$smarty->assign('refer', $refer);
// display templates
tpl_display('login.tpl');
}
示例4: array
<?php
include 'viewer.php';
$data = array('title' => 'hello world', 'h1text' => 'hello smarty');
if (rand(0, 9) < 5) {
$data['debug'] = true;
}
tpl_display('page', $data);
示例5: executeAction
/**
* Contruct controller and execute specific action
*
* @access public
* @param string $controller_name
* @param string $action
* @return null
*/
static function executeAction($controller_name, $action) {
$max_users = config_option('max_users');
if ($max_users && Contacts::count() > $max_users) {
echo lang("error").": ".lang("maximum number of users exceeded error");
return;
}
ajx_check_login();
Env::useController($controller_name);
$controller_class = Env::getControllerClass($controller_name);
if(!class_exists($controller_class, false)) {
throw new ControllerDnxError($controller_name);
} // if
$controller = new $controller_class();
if(!instance_of($controller, 'Controller')) {
throw new ControllerDnxError($controller_name);
} // if
if (is_ajax_request()) {
// if request is an ajax request return a json response
// execute the action
$controller->setAutoRender(false);
$controller->execute($action);
// fill the response
$response = AjaxResponse::instance();
if (!$response->hasCurrent()) {
// set the current content
$response->setCurrentContent("html", $controller->getContent(), page_actions(), ajx_get_panel());
}
$response->setEvents(evt_pop());
$error = flash_pop('error');
$success = flash_pop('success');
if (!is_null($error)) {
$response->setError(1, clean($error));
} else if (!is_null($success)) {
$response->setError(0, clean($success));
}
// display the object as json
tpl_assign("object", $response);
$content = tpl_fetch(Env::getTemplatePath("json"));
tpl_assign("content_for_layout", $content);
TimeIt::start("Transfer");
if (is_iframe_request()) {
tpl_display(Env::getLayoutPath("iframe"));
} else {
tpl_display(Env::getLayoutPath("json"));
}
TimeIt::stop();
} else {
return $controller->execute($action);
}
} // executeAction
示例6: localnet_or_die
localnet_or_die();
// multiuser permission check
permission_or_die(PERM_WRITE, get_owner_id($id));
/*
// remove old cover image from cache
$SQL = 'SELECT imgurl FROM '.TBL_DATA.' WHERE id = '.$id;
$res = runSQL($SQL);
if (count($res))
{
removeCacheFile($res[0]['imgurl']);
}
*/
// remove actual data
runSQL('DELETE FROM ' . TBL_DATA . ' WHERE id = ' . $id);
runSQL('DELETE FROM ' . TBL_VIDEOGENRE . ' WHERE video_id = ' . $id);
//2015-10-6 Alex ADD start
runSQL('DELETE FROM ' . TBL_VIDEOSTUDIO . ' WHERE video_id = ' . $id);
//2015-10-6 Alex ADD end
// clear smarty cache for this item
#!! this does not work- at least not with Smarty3
#$smarty->cache->clear($id);
// goto index instead of delete template
if ($redirect) {
header("Location: index.php?deleteid={$id}");
exit;
}
// prepare templates
tpl_page();
// display templates
tpl_display('delete.tpl');
示例7: _replace_anchors_callback
/**
* Help Page
*
* Browses the manual
*
* @package videoDB
* @author Andreas Gohr <a.gohr@web.de>
* @version $Id: help.php,v 1.10 2004/09/20 15:15:41 andig2 Exp $
*/
require_once './core/functions.php';
function _replace_anchors_callback($matches)
{
if (!preg_match('=^https?://=', $matches[2])) {
$matches[2] = 'help.php?page=' . $matches[2];
}
return $matches[1] . $matches[2] . $matches[3];
}
if (empty($page)) {
$page = 'index.html';
}
$page = 'doc/manual/' . $page;
$html = file_get_contents($page);
$html = preg_replace_callback("/(<a\\s+.*?href\\s*=\\s*\")(.*?)(\".*?>)/is", '_replace_anchors_callback', $html);
preg_match('=<body.*?>(.*)</body>=is', $html, $matches);
$html = $matches[1];
// prepare templates
tpl_page();
$smarty->assign('helptext', $html);
// display templates
tpl_display('help.tpl');
示例8: executeAction
/**
* Contruct controller and execute specific action
*
* @access public
* @param string $controller_name
* @param string $action
* @return null
*/
static function executeAction($controller_name, $action)
{
$max_users = config_option('max_users');
if ($max_users && Users::count() > $max_users) {
echo lang("error") . ": " . lang("maximum number of users exceeded error");
return;
}
ajx_check_login();
if (isset($_GET['active_project']) && logged_user() instanceof User) {
$dont_update = false;
if (GlobalCache::isAvailable()) {
$option_value = GlobalCache::get('user_config_option_' . logged_user()->getId() . '_lastAccessedWorkspace', $success);
if ($success) {
$dont_update = $option_value == $_GET['active_project'];
}
}
if (!$dont_update) {
set_user_config_option('lastAccessedWorkspace', $_GET['active_project'], logged_user()->getId());
if (GlobalCache::isAvailable()) {
GlobalCache::update('user_config_option_' . logged_user()->getId() . '_lastAccessedWorkspace', $_GET['active_project']);
}
}
}
Env::useController($controller_name);
$controller_class = Env::getControllerClass($controller_name);
if (!class_exists($controller_class, false)) {
throw new ControllerDnxError($controller_name);
}
// if
$controller = new $controller_class();
if (!instance_of($controller, 'Controller')) {
throw new ControllerDnxError($controller_name);
}
// if
if (is_ajax_request()) {
// if request is an ajax request return a json response
// execute the action
$controller->setAutoRender(false);
$controller->execute($action);
// fill the response
$response = AjaxResponse::instance();
if (!$response->hasCurrent()) {
// set the current content
$response->setCurrentContent("html", $controller->getContent(), page_actions(), ajx_get_panel());
}
$response->setEvents(evt_pop());
$error = flash_pop('error');
$success = flash_pop('success');
if (!is_null($error)) {
$response->setError(1, clean($error));
} else {
if (!is_null($success)) {
$response->setError(0, clean($success));
}
}
// display the object as json
tpl_assign("object", $response);
$content = tpl_fetch(Env::getTemplatePath("json"));
tpl_assign("content_for_layout", $content);
TimeIt::start("Transfer");
if (is_iframe_request()) {
tpl_display(Env::getLayoutPath("iframe"));
} else {
tpl_display(Env::getLayoutPath("json"));
}
TimeIt::stop();
} else {
return $controller->execute($action);
}
}
示例9: executeStep
/**
* Execute specific step
*
* @access public
* @param integer $step_number
* @return null
*/
function executeStep($step_number)
{
$step = $this->getStep($step_number);
if (!$step instanceof ScriptInstallerStep) {
die("Step '{$step_number}' does not exist in the installation process");
}
// if
tpl_assign('installer', $this);
tpl_assign('current_step', $step);
tpl_assign('installation_name', $this->getInstallationName());
tpl_assign('installation_description', $this->getInstallationDescription());
$execution_result = $step->execute();
// If execute() returns true redirect to next step (if exists)
if ($execution_result) {
$this->addExecutedStep($step_number);
$next_step = $step->getNextStep();
if ($next_step instanceof ScriptInstallerStep) {
$this->goToStep($next_step->getStepNumber());
}
// if
} else {
tpl_display(get_template_path('layout.php'));
}
// if
}
示例10: renderLayout
/**
* Assign content and render layout
*
* @param string $layout_path Path to the layout file
* @param string $content Value that will be assigned to the $content_for_layout
* variable
* @return boolean
* @throws FileDnxError
*/
function renderLayout($layout_path, $content = null, $die = false)
{
tpl_assign('content_for_layout', $content);
$display = tpl_display($layout_path);
if ($die) {
die;
}
// if
return $display;
}
示例11: trace
<?php
trace(__FILE__, 'begin');
$login_show_options = config_option('login_show_options', false);
if ($login_show_options) {
tpl_display(get_template_path('login1', 'access'));
} else {
tpl_display(get_template_path('login2', 'access'));
}
trace(__FILE__, 'end');
示例12: request
* 0: "classic" mode - no use of iframes
* 1: "iframe" mode
* used to display template containing iframe
* 2: "iframe" mode
* used to display iframe contents
*/
if ($iframe == 1) {
// mode 1: display template with url
$url = request(true);
} else {
// mode 0 or 2: fetch data for display
// fetch URL
$fetchtime = time();
$page = request();
$fetchtime = time() - $fetchtime;
// convert HTML for output
$page = fixup_HTML($page);
}
if ($iframe == 2) {
// mode 2: display data into iframe
echo $page;
exit;
}
// mode 0 or 1: prepare templates
tpl_page('imdbbrowser');
$smarty->assign('url', $url);
$smarty->assign('page', $page);
$smarty->assign('fetchtime', $fetchtime);
// display templates
tpl_display('trace.tpl');
示例13: redirect
if (empty($config['enginedefault'])) {
$config['enginedefault'] = 'imdb';
}
// check permissions again - they may have changed
if (!check_permission(PERM_ADMIN)) {
redirect('login.php');
}
// destroy cookies if required
if ($_COOKIE['VDBusername'] && !$config['multiuser']) {
setcookie('VDBpassword', '', time() - 7200);
setcookie('VDBusername', '', time() - 7200);
setcookie('VDBuserid', '', time() - 7200);
}
// cache maintenance
if ($cacheempty) {
// clear thumbnail cache
runSQL('DELETE FROM ' . TBL_CACHE);
// clean HTTP cache
cache_prune_folders(CACHE . '/' . CACHE_HTML . '/', 0, true, false, '*', (int) $config['hierarchical']);
// clean Smarty as well
$smarty->clearAllCache();
}
// prepare options
$setup = setup_mkOptions(false);
// prepare templates
tpl_page('configview');
$smarty->assign('setup', $setup);
$smarty->assign('cacheclear', $cacheempty);
// display templates
tpl_display('setup.tpl');
示例14: out_owners
// build html select box
$all = $lang['filter_any'];
$smarty->assign('owners', out_owners(array($all => $all), PERM_READ));
$smarty->assign('owner', $owner);
// if we don't have read all permissions, limit visibility using cross-user permissions
if (!check_permission(PERM_READ)) {
$JOINS = ' LEFT JOIN ' . TBL_PERMISSIONS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_PERMISSIONS . '.to_uid';
$WHERES .= ' AND ' . TBL_PERMISSIONS . '.from_uid = ' . get_current_user_id() . ' AND ' . TBL_PERMISSIONS . '.permissions & ' . PERM_READ . ' != 0';
}
// further limit to single owner
if ($owner != $all) {
$WHERES .= " AND " . TBL_USERS . ".name = '" . addslashes($owner) . "'";
}
}
// overview on lent disks
$SQL = "SELECT who, DATE_FORMAT(dt,'%d.%m.%Y') as dt, " . TBL_LENT . ".diskid,\n CASE WHEN subtitle = '' THEN title ELSE CONCAT(title,' - ',subtitle) END AS title,\n " . TBL_DATA . ".id, COUNT(" . TBL_LENT . ".diskid) AS count, " . TBL_USERS . ".name AS owner\n FROM " . TBL_LENT . ", " . TBL_DATA . "\n LEFT JOIN " . TBL_USERS . " ON owner_id = " . TBL_USERS . ".id\n {$JOINS}\n WHERE " . TBL_LENT . ".diskid = " . TBL_DATA . ".diskid \n {$WHERES}\n GROUP BY " . TBL_LENT . ".diskid\n ORDER BY who, " . TBL_LENT . ".diskid";
$result = runSQL($SQL);
// check permissions
for ($i = 0; $i < count($result); $i++) {
$result[$i]['editable'] = check_permission(PERM_WRITE, get_userid($result[$i]['owner']));
}
// prepare templates
tpl_page();
$smarty->assign('diskid', $diskid);
$smarty->assign('who', $who);
$smarty->assign('dt', $dt);
$smarty->assign('editable', $editable);
$smarty->assign('borrowlist', $result);
// display templates
tpl_display('borrow.tpl');
示例15: get_current_user_id
LEFT JOIN ' . TBL_USERS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_USERS . '.id
LEFT JOIN ' . TBL_USERSEEN . '
ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . '
WHERE ' . TBL_DATA . '.id = ' . $id;
$video = runSQL($SELECT);
// diskid to global scope:
$diskid = $video[0]['diskid'];
} else {
$video[0]['language'] = $config['langdefault'];
}
// assign automatic disk id
if ($config['autoid'] && (empty($diskid) || $add_flag) && $mediatype != MEDIA_WISHLIST) {
$video[0]['diskid'] = getDiskId();
// Fix for Bugreport [1122052] Automatic DiskID generation problem
$smarty->assign('autoid', $result[0]['max']);
}
if (empty($video[0]['owner_id']) && !empty($owner_id)) {
$video[0]['owner_id'] = $owner_id;
}
// prepare templates
tpl_page();
tpl_edit($video[0]);
$smarty->assign('lookup_id', $lookup);
$smarty->assign('http_error', $CLIENTERROR);
// allow XML import
if ($config['xml'] && empty($id)) {
$smarty->assign('xmlimport', true);
}
// display templates
tpl_display('edit.tpl');