本文整理汇总了PHP中Smarty::assignByRef方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::assignByRef方法的具体用法?PHP Smarty::assignByRef怎么用?PHP Smarty::assignByRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::assignByRef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Assign
/**
* Загружает переменную в шаблон
*
* @param string|array $mName Имя переменной в шаблоне или ассоциативный массив со списком параметров
* @param mixed $mValue Значение переменной. $bByRef = true, то значение должно быть в виде массива array(&$mValue) для корректной работы передачи по ссылке
* @param bool $bLocal Загружает переменную в локальную область видимости шаблонизатора (доступна только для конкретного шаблона)
* @param bool $bByRef Загружает переменную по ссылке
*/
public function Assign($mName, $mValue = null, $bLocal = false, $bByRef = false)
{
if ($bByRef and isset($mValue[0])) {
$this->oSmarty->assignByRef($mName, $mValue[0]);
} else {
$this->oSmarty->assign($mName, $mValue, false, $bLocal);
}
}
示例2: count
$smarty->setConfigDir('../../smarty/configs');
//read questions
$questions = json_decode(file_get_contents($qfile));
$number_questions = count((array) $questions);
//$constits = json_decode(file_get_contents($constitfile));
//read regional info
$region = json_decode(file_get_contents($rfile));
//partners
if (isset($_GET['partner'])) {
switch ($_GET['partner']) {
case 'ihned':
$partner = array('name' => 'ihned', 'swatch_bar' => 'g', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a');
break;
case 'denik':
$partner = array('name' => 'denik', 'swatch_bar' => 'h', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a');
break;
case 'idnes':
$partner = array('name' => 'idnes', 'swatch_bar' => 'i', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'i');
break;
default:
$partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
}
} else {
$partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
}
$smarty->assign('partner', $partner);
$smarty->assignByRef('questions', $questions);
$smarty->assign('number_questions', $number_questions);
$smarty->assign('region', $region);
//$smarty->assignByRef('constits', $constits);
$smarty->display('page-region.tpl');
示例3:
function assign_by_ref($var, &$value)
{
return parent::assignByRef($var, $value);
}
示例4: glob
if ((is_null($enabled_modules) || in_array($filename, $enabled_modules)) && (preg_match('/^[a-zA-Z0-9]/',$filename))
&& (is_dir($suspected_module_dir . $filename)) && file_exists($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'configuration.php')) {
@include($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $_ui_language . DIRECTORY_SEPARATOR . 'strings.php');
include($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'configuration.php');
if (is_dir($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR)) {
$plugins = glob($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . '*.php');
if (!empty($plugins))
foreach ($plugins as $plugin_name)
if (is_readable($plugin_name))
include($plugin_name);
}
}
}
}
$SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
$SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
$SMARTY->assignByRef('_language', $LMS->lang);
$SMARTY->setTemplateDir(null);
$style = ConfigHelper::getConfig('userpanel.style', 'default');
$SMARTY->addTemplateDir(array(
USERPANEL_DIR . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . 'templates',
USERPANEL_DIR . DIRECTORY_SEPARATOR . 'templates',
));
$SMARTY->setCompileDir(SMARTY_COMPILE_DIR);
$SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug');
require_once(USERPANEL_LIB_DIR . DIRECTORY_SEPARATOR . 'smarty_addons.php');
$layout['upv'] = $USERPANEL->_version.' ('.$USERPANEL->_revision.'/'.$SESSION->_revision.')';
$layout['lmsdbv'] = $DB->GetVersion();
$layout['lmsv'] = $LMS->_version;
示例5: DBInit
require_once LIB_DIR . '/LMSDB.php';
$DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME);
// Read configuration of LMS-UI from database
if ($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) {
foreach ($cfg as $row) {
$CONFIG[$row['section']][$row['var']] = $row['value'];
}
}
// Initialize templates engine
require_once LIB_DIR . '/Smarty/Smarty.class.php';
$SMARTY = new Smarty();
// Include required files (including sequence is important)
require_once LIB_DIR . '/language.php';
require_once LIB_DIR . '/definitions.php';
require_once LIB_DIR . '/common.php';
require_once LIB_DIR . '/LMS.class.php';
// Initialize LMS class
$AUTH = NULL;
$LMS = new LMS($DB, $AUTH, $CONFIG);
$LMS->ui_lang = $_ui_language;
$LMS->lang = $_language;
// set some template and layout variables
$SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
$SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
$SMARTY->assignByRef('_language', $LMS->lang);
$SMARTY->template_dir = getcwd();
$SMARTY->compile_dir = SMARTY_COMPILE_DIR;
@(include 'locale/' . $LMS->ui_lang . '/strings.php');
$layout['lmsv'] = '1.11-cvs';
$SMARTY->assignByRef('layout', $layout);
$SMARTY->assignByRef('_config', $CONFIG);
示例6: isset
}
// Set some template and layout variables
$SMARTY->setTemplateDir(NULL);
$SMARTY->addTemplateDir(array(SMARTY_TEMPLATES_DIR . '/custom', SMARTY_TEMPLATES_DIR));
$SMARTY->compile_dir = SMARTY_COMPILE_DIR;
$SMARTY->debugging = isset($CONFIG['phpui']['smarty_debug']) ? chkconfig($CONFIG['phpui']['smarty_debug']) : FALSE;
$SMARTY->use_sub_dirs = TRUE;
//$SMARTY->error_reporting = false;
$SMARTY->error_unassigned = false;
$my_security_policy = new Smarty_Security($SMARTY);
$my_security_policy->allow_php_tag = true;
$my_security_policy->php_functions = array();
$my_security_policy->php_handling = Smarty::PHP_PASSTHRU;
$my_security_policy->php_modifier = array();
$my_security_policy->modifiers = array();
$SMARTY->assignByRef('layout', $layout);
$SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
$SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
$SMARTY->assignByRef('_language', $LMS->lang);
$error = NULL;
// initialize error variable needed for (almost) all modules
header('X-Powered-By: iNET LMS/' . $layout['lmsv']);
$PLUG->updateDBPlugins();
// Check privileges and execute modules
if ($AUTH->islogged) {
$RIGHTS_LIST = $_RL_ = $RIGHTS_USER = array();
// info o polach w formularzach
if ($cfg = $DB->GetAll('SELECT section, var, value FROM formconfig')) {
foreach ($cfg as $row) {
$CONFIGFORM[$row['section']][$row['var']] = $row['value'] ? $row['value'] : 0;
}
示例7: array
break;
case 'denik':
$partner = array('name' => 'denik', 'swatch_bar' => 'h', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a');
break;
default:
$partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
}
} else {
$partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
}
/*print_r($user);
print_r($parties);
print_r($questions);
die();*/
$smarty->assign('partner', $partner);
$smarty->assignByRef('questions', $questions);
$smarty->assignByRef('parties', $parties);
$smarty->assign('region', $region);
$smarty->assign('user', $user);
$smarty->assign('order', $order2);
$smarty->display('compare.tpl');
//save email if provided
if (isset($_GET['email']) and $_GET['email'] != '') {
$str = session_id() . "\t" . $region->code . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . trim($_GET['email']) . "\n";
$file = fopen('../../email.txt', 'a');
fwrite($file, $str);
fclose($file);
}
/**
* extracts user's answers
*/
示例8: Smarty
foreach (filesys::getFilesInDir(SD_ROOT_DIR . 'install/lang/' . $currLang . '/') as $fileLang) {
require_once SD_ROOT_DIR . 'install/lang/' . $currLang . '/' . $fileLang;
}
/********** Инициализация Smarty **********/
define('SMARTY_SPL_AUTOLOAD', 1);
require_once SD_ROOT_DIR . 'install/Smarty/Smarty.class.php';
$smarty = new Smarty();
//core smarty object
$smarty->error_reporting = E_ALL & ~E_NOTICE;
$smarty->template_dir = SD_ROOT_DIR . 'install/templates/';
$smarty->compile_dir = SD_ROOT_DIR . 'install/templates_c/';
$smarty->debugging = false;
$smarty->force_compile = true;
####################################################################
############################### INIT ###############################
####################################################################
if (isset($_GET['step']) && (int) $_GET['step'] && $_GET['step'] > 0) {
if (@file_exists(SD_ROOT_DIR . 'install/includes/step' . $_GET['step'] . '.php') && @file_exists(SD_ROOT_DIR . 'install/templates/step' . $_GET['step'] . '.tpl')) {
$arrErrors = array();
include_once SD_ROOT_DIR . 'install/includes/step' . $_GET['step'] . '.php';
$main_template = 'step' . $_GET['step'] . '.tpl';
/********** Передаем в Smarty выводимый шаблон и отображаем его **********/
$smarty->assignByRef('mainTemplate', $main_template);
$smarty->assignByRef('arrErrors', $arrErrors);
$smarty->display('index.tpl');
} else {
exit(ERROR_INSTALL_FILES_NOT_EXISTS);
}
} else {
exit(ERROR_NOT_PAGE_FOUND);
}
示例9: show
{
foreach ($items as &$item) {
if ($item['id'] == $id) {
$path[] = array($item['url'], $item['name']);
return true;
}
if (self::find_path($id, $item['children'], $path)) {
$path[] = array($item['url'], $item['name']);
return true;
}
}
return false;
}
}
$menuid = '';
$smarty->assignByRef('menuid', $menuid);
function show($template, $name)
{
global $smarty, $lang;
$smarty->assign('name', $name);
$smarty->assign('tpl', "{$template}.tpl");
$crumbs = array();
$mid = $_REQUEST['mid'];
if ($mid) {
$crumbs = MainMenu::path($mid);
} else {
if ($_REQUEST['referer']) {
$referer = array();
parse_str(parse_url($_REQUEST['referer'], PHP_URL_QUERY), $referer);
if (array_key_exists('mid', $referer)) {
$mid = $referer['mid'];
示例10: getComments
/**
* Return all comments for a given kill
*
* @global Smarty $smarty
* @param integer $kll_id
* @param string $message
* @return xajaxResponse
*/
function getComments($kll_id, $message = '')
{
if (config::get('comments')) {
$kll_id = intval($kll_id);
$comments = new Comments($kll_id);
global $smarty;
$config = new Config();
if (!$smarty) {
$smarty = new Smarty();
$themename = config::get('theme_name');
if (is_dir('./themes/' . $themename . '/templates')) {
$smarty->template_dir = './themes/' . $themename . '/templates';
} else {
$smarty->template_dir = './themes/default/templates';
}
if (!is_dir(KB_CACHEDIR . '/templates_c/' . $themename)) {
mkdir(KB_CACHEDIR . '/templates_c/' . $themename);
}
$smarty->compile_dir = KB_CACHEDIR . '/templates_c/' . $themename;
$smarty->cache_dir = KB_CACHEDIR . '/data';
$smarty->assign('theme_url', THEME_URL);
$smarty->assign('theme_name', $themename);
$smarty->assign('img_url', config::get('cfg_img'));
$smarty->assign('img_host', IMG_HOST);
$smarty->assign('kb_host', KB_HOST);
$smarty->assignByRef('config', $config);
$smarty->assign('is_IGB', IS_IGB);
$smarty->assign('kll_id', $kll_id);
}
$smarty->assignByRef('page', new Page("Comments"));
$message = $message . $comments->getHtml(true);
} else {
$message = '';
}
$objResponse = new xajaxResponse();
$objResponse->assign('kl-detail-comment-list', "innerHTML", $message);
return $objResponse;
}
示例11: array
//}
}
usort($las, 'cmp');
//rename order
$order2 = array();
foreach ($user['order'] as $row) {
$order2[] = $row;
}
//read questions
$questions = json_decode(file_get_contents($qfile));
/*print_r($user);
print_r($parties);
print_r($questions);
die();*/
$smarty->assign('partner', $partner);
$smarty->assignByRef('questions', $questions);
$smarty->assignByRef('parties', $candidates);
$smarty->assignByRef('long_answers', $las);
$smarty->assign('region', $region);
$smarty->assign('user', $user);
$smarty->assign('order', $order2);
$smarty->display('compare-president.tpl');
//save email if provided
if (isset($_GET['email']) and $_GET['email'] != '') {
$str = session_id() . "\t" . $region->code . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . trim($_GET['email']) . "\n";
$file = fopen('../../email.txt', 'a');
fwrite($file, $str);
fclose($file);
}
/**
*
示例12: catch
try {
$tpl->template_dir = $path . 'themes/templates/';
$tpl->compile_dir = $path . 'themes/templates/templates_c/';
$tpl->config_dir = $path . 'modules/lang/';
} catch (SmartyException $e) {
}
//Variable du template
$arrStr = explode("/", $_SERVER['SCRIPT_NAME']);
$arrStr = array_reverse($arrStr);
$tpl->assign('url', $arrStr[0]);
$dedis = ORM::for_table('habbophp_dedis')->find_many();
$tpl->assign('dedis', $dedis);
$tpl->assign('emulator', EMULATOR);
$tpl->assign('lang_dir', $path . 'modules/lang');
$tpl->assign('lang', $config->lang);
$tpl->assignByRef('config', $config);
$tpl->assignByRef('user', $user);
$tpl->configLoad($path . 'modules/lang/' . $config->lang . '.lang');
define('SMARTY_DEBUG_CONSOLE', false);
$k_public = '6LenR88SAAAAAMcaw4UWGvAUyDD_HIj97eUBsNhf';
$privatekey = '6LenR88SAAAAAGhwPRprdBpxYR1D591QjX-TVgB9';
$tpl->assign('captcha', recaptcha_get_html($k_public));
$tpl->assign('public_key', $k_public);
/*+===================================+
| Gestion des erreurs |
+===================================+*/
if (!isset($_SERVER['REQUEST_URI']) or empty($_SERVER['REQUEST_URI'])) {
if (substr($_SERVER['SCRIPT_NAME'], -9) == 'index.php' && empty($_SERVER['QUERY_STRING'])) {
$_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']) . '/';
} else {
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
示例13: array
echo $modname . " <br> ";
}
echo "</body>";
die;
}
$none = '';
event::call('mods_initialised', $none);
if (!$settingsPage && !file_exists('common/' . $page . '.php') && !$modOverrides) {
$page = 'home';
}
$smarty->assign('theme_name', $themename);
$smarty->assign('theme_url', THEME_URL);
$smarty->assign('img_url', IMG_URL);
$smarty->assign('img_host', IMG_HOST);
$smarty->assign('kb_host', KB_HOST);
$smarty->assignByRef('config', $config);
$smarty->assign('is_IGB', IS_IGB);
// Set the name of the board owner.
$owners = array();
if (config::get('cfg_allianceid')) {
foreach (config::get('cfg_allianceid') as $owner) {
$alliance = new Alliance($owner);
$owners[] = htmlentities($alliance->getName());
}
unset($alliance);
}
if (config::get('cfg_corpid')) {
foreach (config::get('cfg_corpid') as $owner) {
$corp = new Corporation($owner);
$owners[] = htmlentities($corp->getName());
}
示例14: array
}
}
usort($candidates, 'cmp');
//rename order
$order2 = array();
foreach ($user['order'] as $row) {
$order2[] = $row;
}
//read questions
$questions = json_decode(file_get_contents($qfile));
/*print_r($user);
print_r($parties);
print_r($questions);
die();*/
$smarty->assign('partner', $partner);
$smarty->assignByRef('questions', $questions);
$smarty->assignByRef('parties', $candidates);
$smarty->assign('region', $region);
$smarty->assign('user', $user);
$smarty->assign('order', $order2);
$smarty->display('compare.tpl');
//save email if provided
if (isset($_GET['email']) and $_GET['email'] != '') {
$str = session_id() . "\t" . $region->code . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . trim($_GET['email']) . "\n";
$file = fopen('../../email.txt', 'a');
fwrite($file, $str);
fclose($file);
}
/**
*
*/
示例15: isset
}
// Set some template and layout variables
$SMARTY->setTemplateDir(NULL);
$SMARTY->addTemplateDir(array(SMARTY_TEMPLATES_DIR . '/custom', SMARTY_TEMPLATES_DIR));
$SMARTY->compile_dir = SMARTY_COMPILE_DIR;
$SMARTY->debugging = isset($CONFIG['phpui']['smarty_debug']) ? chkconfig($CONFIG['phpui']['smarty_debug']) : FALSE;
$SMARTY->use_sub_dirs = TRUE;
//$SMARTY->error_reporting = false;
$SMARTY->error_unassigned = false;
$my_security_policy = new Smarty_Security($SMARTY);
$my_security_policy->allow_php_tag = true;
$my_security_policy->php_functions = array();
$my_security_policy->php_handling = Smarty::PHP_PASSTHRU;
$my_security_policy->php_modifier = array();
$my_security_policy->modifiers = array();
$SMARTY->assignByRef('layout', $layout);
$SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
$SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
$SMARTY->assignByRef('_language', $LMS->lang);
$SMARTY->assignByRef('global_warning', $SESSION->global_warning);
$error = NULL;
// initialize error variable needed for (almost) all modules
header('X-Powered-By: iNET LMS/' . $layout['lmsv']);
$PLUG->initPlugins();
$PLUG->updateDBPlugins();
$PLUG->IncludeRegisterHook();
// Check privileges and execute modules
if ($AUTH->islogged) {
$RIGHTS_LIST = $_RL_ = $RIGHTS_USER = array();
// info o polach w formularzach
if ($cfg = $DB->GetAll('SELECT section, var, value FROM formconfig')) {