本文整理汇总了PHP中TemplatePower::assignGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplatePower::assignGlobal方法的具体用法?PHP TemplatePower::assignGlobal怎么用?PHP TemplatePower::assignGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplatePower
的用法示例。
在下文中一共展示了TemplatePower::assignGlobal方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Main
function Main()
{
global $TPLV, $bottom, $urls, $db, $migalha;
$TPLV = new TemplatePower(TEMPLATE_PATH . "modulos/categoria.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH_SITE);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH_SITE);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->assignGlobal($urls->var);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
default:
case 'lista':
lista();
break;
case 'novo':
novo();
break;
case 'editar':
editar();
break;
case 'salvar':
salvar();
break;
case 'deletar':
deletar();
break;
}
}
示例2: Main
function Main()
{
global $TPLV, $bottom, $db, $migalha, $usuario;
$TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
default:
case 'restrito':
if ($usuario->isLogado()) {
inicio();
} else {
restrito();
}
break;
case 'inicio':
inicio();
break;
case 'logout':
logout();
break;
}
}
示例3: Main
function Main()
{
global $TPLV, $urls, $usuario, $imovel;
$TPLV = new TemplatePower(TEMPLATE_PATH . "login.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->assignGlobal($urls->var);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
//FILTROS DE BUSCAS
default:
case 'deletaUsuario':
deletaUsuario();
break;
case 'deletaMidia':
deletaMidia();
break;
//LOGIN E RECUPERA SENHA
//LOGIN E RECUPERA SENHA
case 'getLogin':
getLogin();
break;
case 'login':
login();
break;
case 'getSenha':
getSenha();
break;
case 'recuperaSenha':
recuperaSenha();
break;
case 'isLogado':
if ($usuario->isLogado()) {
echo 'logado';
} else {
echo 'erro';
}
break;
//CADASTRO
//CADASTRO
case 'validaEmailCadastro':
validaEmailCadastro();
break;
//LEADS DETALHES
//LEADS DETALHES
case 'getCadastro':
getCadastro();
break;
case 'salvarCadastro':
salvarCadastro();
break;
case 'verificaCPF':
verificaCPF();
break;
}
}
示例4: createPropelClasses
/**
* DEPRECATED createPropelClasses()
*
* Don't use this method, it was left only for backward compatibility
* for some external plugins that still is using it
*/
public function createPropelClasses($sTableName, $sClassName, $aFields, $sAddTabUid, $connection = 'workflow')
{
try {
/* $aUID = array('FLD_NAME' => 'PM_UNIQUE_ID',
'FLD_TYPE' => 'INT',
'FLD_KEY' => 'on',
'FLD_SIZE' => '11',
'FLD_NULL' => '',
'FLD_AUTO_INCREMENT' => 'on');
array_unshift($aFields, $aUID); */
$aTypes = array(
'VARCHAR' => 'string',
'TEXT' => 'string',
'DATE' => 'int',
'INT' => 'int',
'FLOAT' => 'double'
);
$aCreoleTypes = array(
'VARCHAR' => 'VARCHAR',
'TEXT' => 'LONGVARCHAR',
'DATE' => 'TIMESTAMP',
'INT' => 'INTEGER',
'FLOAT' => 'DOUBLE'
);
if ($sClassName == '') {
$sClassName = $this->getPHPName($sTableName);
}
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
if (!file_exists($sPath)) {
G::mk_dir($sPath);
}
if (!file_exists($sPath . 'map')) {
G::mk_dir($sPath . 'map');
}
if (!file_exists($sPath . 'om')) {
G::mk_dir($sPath . 'om');
}
$aData = array();
$aData['pathClasses'] = substr(PATH_DB, 0, -1);
$aData['tableName'] = $sTableName;
$aData['className'] = $sClassName;
$aData['connection'] = $connection;
$aData['GUID'] = $sAddTabUid;
$aData['firstColumn'] = isset($aFields[0])
? strtoupper($aFields[0]['FLD_NAME'])
: ($aFields[1]['FLD_NAME']);
$aData['totalColumns'] = count($aFields);
$aData['useIdGenerator'] = 'false';
$oTP1 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'Table.tpl');
$oTP1->prepare();
$oTP1->assignGlobal($aData);
file_put_contents($sPath . $sClassName . '.php', $oTP1->getOutputContent());
$oTP2 = new TemplatePower(PATH_TPL . 'additionalTables' . PATH_SEP . 'TablePeer.tpl');
$oTP2->prepare();
$oTP2->assignGlobal($aData);
file_put_contents($sPath . $sClassName . 'Peer.php', $oTP2->getOutputContent());
$aColumns = array();
$aPKs = array();
$aNotPKs = array();
$i = 0;
foreach ($aFields as $iKey => $aField) {
$aField['FLD_NAME'] = strtoupper($aField['FLD_NAME']);
if ($aField['FLD_TYPE'] == 'DATE') {
$aField['FLD_NULL'] = '';
}
$aColumn = array(
'name' => $aField['FLD_NAME'],
'phpName' => $this->getPHPName($aField['FLD_NAME']),
'type' => $aTypes[$aField['FLD_TYPE']],
'creoleType' => $aCreoleTypes[$aField['FLD_TYPE']],
'notNull' => ($aField['FLD_NULL'] == 'on' ? 'true' : 'false'),
'size' => (($aField['FLD_TYPE'] == 'VARCHAR')
|| ($aField['FLD_TYPE'] == 'INT')
|| ($aField['FLD_TYPE'] == 'FLOAT') ? $aField['FLD_SIZE'] : 'null'),
'var' => strtolower($aField['FLD_NAME']),
'attribute' => (($aField['FLD_TYPE'] == 'VARCHAR')
|| ($aField['FLD_TYPE'] == 'TEXT')
|| ($aField['FLD_TYPE'] == 'DATE')
? '$' . strtolower($aField['FLD_NAME']) . " = ''"
: '$' . strtolower($aField['FLD_NAME']) . ' = 0'),
'index' => $i,
);
if ($aField['FLD_TYPE'] == 'DATE') {
$aColumn['getFunction'] = '/**
* Get the [optionally formatted] [' . $aColumn['var'] . '] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the integer unix timestamp will be returned.
* @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
* @throws PropelException - if unable to convert the date/time to timestamp.
*/
public function get' . $aColumn['phpName'] . '($format = "Y-m-d")
//.........这里部分代码省略.........
示例5: unset
$tp->assign($k, $v);
}
if ($CurMess['message_type'] == 1 or $CurMess['message_type'] == 2) {
unset($replace);
$tp->newBlock("answer");
$replace[id] = $CurMess['message_sender'];
$replace[subject] = $lang['mess_answer_prefix'] . htmlspecialchars($CurMess['message_subject']);
foreach ($replace as $k => $v) {
$tp->assign($k, $v);
}
}
}
break;
}
$tp->gotoBlock("_ROOT");
$tp->assignGlobal("PHPSELF", $_SERVER['PHP_SELF']);
foreach ($lang as $name => $trans) {
$tp->assignGlobal("lang_" . $name, $trans);
}
$page .= $tp->getOutputContent();
display($page, $lang['mess_pagetitle']);
} else {
$OwnerID = $_GET['id'];
$MessCategory = $_GET['messcat'];
$MessPageMode = $_GET["mode"];
$DeleteWhat = $_POST['deletemessages'];
if (isset($DeleteWhat)) {
$MessPageMode = "delete";
}
$UsrMess = doquery("SELECT * FROM {{table}} WHERE `message_owner` = '" . $user['id'] . "' ORDER BY `message_time` DESC;", 'messages');
$UnRead = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $user['id'] . "';", 'users', true);
示例6: foreach
// ACTIONS
$actions = _TooltipActions($planetsrow[$i], $g, $s, $i, 0);
$tp->assign("actions", $actions);
} else {
// ADD BLANK TDS ?
}
}
$replace[fleet_count] = $MaxFleetCount;
$replace[fleet_max] = $FleetMax;
$replace[Recyclers] = pretty_number($CurrentRC);
$replace[SpyProbes] = pretty_number($CurrentSP);
$replace[CurrentMIP] = pretty_number($CurrentMIP);
$replace[this_galaxy] = $planetrow['galaxy'];
$replace[this_system] = $planetrow['system'];
$replace[this_planet] = $planetrow['planet'];
$replace[this_planet_type] = $planetrow['planet_type'];
$replace[PHP_SELF] = $_SERVER['PHP_SELF'];
$tp->gotoBlock("_ROOT");
if (is_array($replace)) {
foreach ($replace as $k => $v) {
$tp->assign($k, $v);
}
}
// GLOBAL VARIABLES
$lang[dpath] = $dpath;
foreach ($lang as $name => $trans) {
$tp->assignGlobal($name, $trans);
}
$galaxy = $tp->getOutputContent();
display($galaxy, 'Galaxy', false);
}
示例7: TemplatePower
<?php
require_once 'config.inc.php';
$tpl_main = new TemplatePower('template/master.html');
$tpl_main->prepare();
// see if the login form was submitted
if (isset($_POST['login'])) {
$user = stripslashes($_POST['username']);
$pass = stripslashes($_POST['password']);
$goto = $_POST['redirect'];
if ($_AUTH->login($user, $pass)) {
include_once $goto;
die;
} else {
$tpl = new TemplatePower('template/error.html');
$tpl->assignGlobal('error_message', 'Invalid username / password.' . $user);
}
// display the default login form
} else {
$tpl = new TemplatePower('template/login.html');
$tpl->assignGlobal('redirect', $_GET['redirect']);
}
$tpl->prepare();
$tpl->showUnAssigned(false);
$tpl_main->assign('content', $tpl->getOutputContent());
$tpl_main->showUnAssigned(false);
$tpl_main->printToScreen();
示例8: get_user_courses
}
// pull the template together
$tpl->prepare();
// display the selected course
if (isset($course)) {
$c = get_user_courses($_DB);
$course = $c[0]['courseID'];
set_course_template($_DB, $tpl, $course);
}
// add the remaining components to the template
$tpl->assignGlobal('course_select_box', gen_course_select_box($_DB));
$tpl->assignGlobal('username', $_SESSION['userName']);
}
// for all of the pages, put the content into the main template
$tpl->showUnAssigned(false);
$tpl_main->assignGlobal("content", $tpl->getOutputContent());
$tpl_main->showUnAssigned(false);
$tpl_main->printToScreen();
/**
* Return a list of courses that the user is enrolled in
*
* @db the MySQL database connection
*
**/
function get_user_courses($db)
{
$user = $_SESSION['userID'];
$db->sql_query("SELECT * FROM courses WHERE courseID = ( SELECT course FROM studentstocourses WHERE student = '{$user}' ) ");
return $db->sql_fetchrowset();
}
/**
示例9: formataEmail
/**
* Formata a news padrão da linklar
* @params string $titulo
* @params string $texto
* @returns html formatada.
*/
public function formataEmail($titulo, $texto)
{
global $geral;
$MAIL = new TemplatePower(TEMPLATE_PATH . "includes/mail.tpl");
$MAIL->assignGlobal("uploadPath", UPLOAD_PATH);
$MAIL->assignGlobal("imagePath", IMAGE_PATH);
$MAIL->prepare();
$MAIL->newBlock('mail');
$MAIL->assign('titulo', $titulo);
$MAIL->assign('texto', $texto);
return $MAIL->getOutputContent();
}
示例10: create_file_from_tpl
function create_file_from_tpl($tplName, $newFilename, $fields = NULL)
{
global $pathHome;
global $projectName;
$httpdTpl = PATH_GULLIVER_HOME . 'bin' . PATH_SEP . 'tasks' . PATH_SEP . 'templates' . PATH_SEP . $tplName . '.tpl';
if (substr($newFilename, 0, 1) == PATH_SEP) {
$httpFilename = $newFilename;
} else {
$httpFilename = $pathHome . PATH_SEP . $newFilename;
}
$template = new TemplatePower($httpdTpl);
$template->prepare();
$template->assignGlobal('pathHome', $pathHome);
$template->assignGlobal('projectName', $projectName);
$template->assignGlobal('rbacProjectName', strtoupper($projectName));
$template->assignGlobal('siglaProjectName', substr(strtoupper($projectName), 0, 3));
$template->assignGlobal('propel.output.dir', '{propel.output.dir}');
if (is_array($fields)) {
foreach ($fields as $block => $data) {
$template->gotoBlock("_ROOT");
if (is_array($data)) {
foreach ($data as $rowId => $row) {
$template->newBlock($block);
foreach ($row as $key => $val) {
if (is_array($val)) {
// $template->newBlock( $key );
foreach ($val as $key2 => $val2) {
if (is_array($val2)) {
$template->newBlock($key);
foreach ($val2 as $key3 => $val3) {
$template->assign($key3, $val3);
}
}
}
} else {
$template->assign($key, $val);
}
}
}
} else {
$template->assign($block, $data);
}
}
}
$content = $template->getOutputContent();
$iSize = file_put_contents($httpFilename, $content);
printf("saved %s bytes in file %s \n", pakeColor::colorize($iSize, 'INFO'), pakeColor::colorize($tplName, 'INFO'));
}
示例11: ShowMessagesPage
//.........这里部分代码省略.........
$replace[total] = $TotalMess[$id];
$replace[name] = $lang['mg_type'][$id];
foreach ($replace as $k => $v) {
$tp->assign($k, $v);
}
}
switch ($MessPageMode) {
case 'write':
if ($_REQUEST['subject']) {
$subject = $_REQUEST['subject'];
}
if (!is_numeric($OwnerID)) {
header("location:game.php?page=messages");
}
$OwnerRecord = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $OwnerID . "';", 'users', true);
if (!$OwnerRecord) {
header("location:game.php?page=messages");
}
$OwnerHome = doquery("SELECT * FROM {{table}} WHERE `id_planet` = '" . $OwnerRecord["id_planet"] . "';", 'galaxy', true);
if (!$OwnerHome) {
header("location:game.php?page=messages");
}
if ($_POST) {
$error = 0;
$errorlist = "";
if (!$_POST["subject"] & !$_POST["text"]) {
$errorlist .= $lang['mg_no_text_subject'];
$error++;
} elseif (!$_POST["subject"]) {
$errorlist .= $lang['mg_no_subject'];
$error++;
} elseif (!$_POST["text"]) {
$errorlist .= $lang['mg_no_text'];
$error++;
}
if ($error != 0) {
message($errorlist);
} else {
$_POST['text'] = str_replace("'", ''', $_POST['text']);
// $_POST['text'] = str_replace('rn', '<br />', $_POST['text']);
$Owner = $OwnerID;
$Sender = $CurrentUser['id'];
$From = $CurrentUser['username'] . " [" . $CurrentUser['galaxy'] . ":" . $CurrentUser['system'] . ":" . $CurrentUser['planet'] . "]";
$Subject = $_POST['subject'];
$Message = preg_replace("/([^\\s]{80}?)/", "\\1<br />", trim(nl2br(strip_tags($_POST['text'], '<br>'))));
SendSimpleMessage($Owner, $Sender, '', 1, $From, $Subject, $Message);
$subject = "";
$text = "";
message($lang['mg_msg_sended'], "game.php?page=messages", "2");
}
}
$parse['id'] = $OwnerID;
$parse['to'] = $OwnerRecord['username'] . " [" . $OwnerHome['galaxy'] . ":" . $OwnerHome['system'] . ":" . $OwnerHome['planet'] . "]";
$parse['subject'] = !isset($subject) ? $lang['mg_sin_subject'] : $subject;
$parse['text'] = $text;
$tp->newBlock("new_message");
$tp->assign("new_message", parsetemplate(gettemplate('messages_pm_form'), $parse));
break;
default:
case 'show':
if ($CurrentUser["new_message"] != 0) {
doquery("UPDATE {{table}} SET `new_message` ='0' WHERE `id` = '" . $CurrentUser['id'] . "' ", "users", '');
}
if ($MessCategory == 100) {
$UsrMess = doquery("SELECT SQL_CACHE * FROM {{table}} WHERE `message_owner` = " . $CurrentUser['id'] . " ORDER BY `message_time` DESC;", 'messages', '');
} else {
$UsrMess = doquery("SELECT SQL_CACHE * FROM {{table}} WHERE `message_owner` = " . $CurrentUser['id'] . " AND `message_type` = " . intval($MessCategory) . " ORDER BY `message_time` DESC;", 'messages', '');
}
while ($CurMess = @mysql_fetch_array($UsrMess)) {
unset($replace);
$tp->newBlock("message");
$replace[id] = $CurMess['message_id'];
$replace[mdate] = date("m-d H:i:s O", $CurMess['message_time']);
$replace[from] = stripslashes($CurMess['message_from']);
$replace[subject] = stripslashes($CurMess['message_subject']);
//$replace[message] = makeMessageSmilies(nl2br( stripslashes( $CurMess['message_text'] ) ));
$replace[message] = nl2br(stripslashes($CurMess['message_text']));
foreach ($replace as $k => $v) {
$tp->assign($k, $v);
}
if ($CurMess['message_type'] == 1 or $CurMess['message_type'] == 2) {
unset($replace);
$tp->newBlock("answer");
$replace[id] = $CurMess['message_sender'];
$replace[subject] = $lang['mg_answer_prefix'] . htmlspecialchars($CurMess['message_subject']);
foreach ($replace as $k => $v) {
$tp->assign($k, $v);
}
}
}
break;
}
$tp->gotoBlock("_ROOT");
$tp->assignGlobal("PHPSELF", $_SERVER['PHP_SELF']);
foreach ($lang as $name => $trans) {
$tp->assignGlobal("lang_" . $name, $trans);
}
$page .= $tp->getOutputContent();
display($page);
}
示例12: Main
function Main()
{
global $TPLV, $bottom, $urls, $db, $migalha;
$TPLV = new TemplatePower(TEMPLATE_PATH . "modulos/produtos.tpl");
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH);
$TPLV->assignGlobal("uploadPath", UPLOAD_PATH_SITE);
$TPLV->assignGlobal("imagePath", IMAGE_PATH);
$TPLV->assignGlobal("swfPath", SWF_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH);
$TPLV->assignGlobal("localPath", LOCAL_PATH_SITE);
$TPLV->assignGlobal('navBottom', $bottom);
$TPLV->assignGlobal($urls->var);
$TPLV->prepare();
$in = $_GET['in'];
switch ($in) {
default:
/**- LISTA DE CATEGORIAS -**/
/**- LISTA DE CATEGORIAS -**/
case 'lista':
lista();
break;
case 'nova':
nova();
break;
case 'edita':
edita();
break;
case 'salva':
salva();
break;
case 'apagaFoto':
apagaFoto();
break;
case 'deleta':
deleta();
break;
/**- LISTA DE PRODUTOS -**/
/**- LISTA DE PRODUTOS -**/
case 'listar':
listar();
break;
case 'novo':
novo();
break;
case 'editar':
editar();
break;
case 'download':
download();
break;
case 'download_salvar':
download_salvar();
break;
case 'download_deletar':
download_deletar();
break;
case 'salvar':
salvar();
break;
case 'deletar':
deletar();
break;
case 'deletarNutricional':
deletarNutricional();
break;
case 'apagarFoto':
apagarFoto();
break;
}
}