本文整理汇总了PHP中getTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP getTemplate函数的具体用法?PHP getTemplate怎么用?PHP getTemplate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTemplate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OpcionesBusqueda
function OpcionesBusqueda($retorno)
{
global $action;
$ot = getTemplate("xulBusquedaAvanzada");
if (!$ot) {
error(__FILE__ . __LINE__, "Info: template no encontrado");
return false;
}
$idprov = getSesionDato("FiltraProv");
$idmarca = getSesionDato("FiltraMarca");
$idcolor = getSesionDato("FiltraColor");
$idtalla = getSesionDato("FiltraTalla");
$idfamilia = getSesionDato("FiltraFamilia");
$ot->fijar("action", $action);
$ot->fijar("pagRetorno", $retorno);
$ot->fijar("comboProveedores", genXulComboProveedores($idprov));
$ot->fijar("comboMarcas", genXulComboMarcas($idmarca));
$ot->fijar("comboFamilias", genXulComboMarcas($idfamilia));
//echo q($idcolor,"color a mostrar en template");
//echo q(intval($idcolor),"intval color a mostrar en template");
if (intval($idcolor) >= 0) {
$ot->fijar("comboColores", genXulComboColores($idcolor));
} else {
$ot->fijar("comboColores", genXulComboColores("ninguno"));
}
$ot->fijar("comboTallas", genXulComboTallas($idtalla));
echo $ot->Output();
}
示例2: GenEtiqueta
function GenEtiqueta($id, $precio = 0)
{
global $action;
$ot = getTemplate("Etiqueta");
if (!$ot) {
error(__FILE__ . __LINE__, "Info: template busqueda no encontrado");
echo "1!";
return false;
}
$oProducto = new producto();
if (!$oProducto->Load($id)) {
error(__FILE__ . __LINE__, "Info: producto no encontrado");
echo "2!";
return false;
}
$bar = $oProducto->getCB();
$nombre = $oProducto->getDescripcion();
$marca = $oProducto->getMarcaTexto();
$nombre = $nombre . ' ' . $marca;
$cr = "&";
$cad = "barcode=" . $bar . $cr;
$cad .= "format=gif" . $cr;
$cad .= "text={$bar}" . $cr;
$cad .= "text=" . urlencode($nombre . " - " . $oProducto->get("Referencia")) . $cr;
$cad .= "width=" . getParametro("AnchoBarras") . $cr;
$cad .= "height=" . getParametro("AltoBarras") . $cr;
$urlbarcode = "modulos/barcode/barcode.php?" . $cad;
$ot->fijar("urlbarcode", $urlbarcode);
$ot->fijar("precio", FormatMoney($precio));
$ot->fijar("talla", $oProducto->getTextTalla());
$ot->fijar("color", $oProducto->getTextColor());
$ot->fijar("referencia", $oProducto->get("Referencia"));
$ot->fijar("nombre", $nombre);
echo $ot->Output();
}
示例3: ask_yesno
/**
* Prints Question on screen.
*
* @param string The question
* @param string File which will be called with POST if user clicks yes
* @param array Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
* @param string Name of the target eg Domain or eMail address etc.
*
* @author Florian Lippert <flo@syscp.org>
*/
function ask_yesno($text, $yesfile, $params = array(), $targetname = '')
{
global $userinfo, $db, $s, $header, $footer, $lng;
/*
// For compatibility reasons (if $params contains a string like "field1=value1;field2=value2") this will convert it into a usable array
if(!is_array($params))
{
$params_tmp=explode(';',$params);
unset($params);
$params=array();
while(list(,$param_tmp)=each($params_tmp))
{
$param_tmp=explode('=',$param_tmp);
$params[$param_tmp[0]]=$param_tmp[1];
}
}
*/
$hiddenparams = '';
if (is_array($params)) {
foreach ($params as $field => $value) {
$hiddenparams .= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
}
}
if (isset($lng['question'][$text])) {
$text = $lng['question'][$text];
}
$text = strtr($text, array('%s' => $targetname));
eval('echo "' . getTemplate('misc/question_yesno', '1') . '";');
exit;
}
示例4: displayPage
function displayPage($name, $html_dirs = NULL)
{
global $CurrentPageName;
global $CurrentPageDirectory;
global $ActiveButton;
// Save name as a global
$CurrentPageName = $name;
// Initialize directory as a global
$CurrentPageDirectory = HOME_DIR;
// Assume page name is active button
$ActiveButton = $name;
// Set default for html directories
if (!is_array($html_dirs)) {
$html_dirs = array(HOME_DIR);
}
// See if the site is offline
if (file_exists("OFFLINE")) {
getTemplate("offlineTemplate.php");
} elseif (!preg_match("/^[a-z0-9\\-]*\$/i", $name)) {
getTemplate("notfoundTemplate.php");
} else {
$found = false;
foreach ($html_dirs as $dir) {
if (file_exists("{$dir}/{$name}.html")) {
$CurrentPageDirectory = "{$dir}/";
$found = true;
getTemplate("pageTemplate.php");
break;
}
}
if (!$found) {
getTemplate("notfoundTemplate.php");
}
}
}
示例5: getFormFieldOutputBool
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
function getFormFieldOutputBool($fieldname, $fielddata)
{
$label = $fielddata['label'];
$boolswitch = makeYesNo($fieldname, '1', '0', $fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/bool", true) . "\";");
return $returnvalue;
}
示例6: standard_error
/**
* Prints one ore more errormessages on screen
*
* @param array Errormessages
* @param string A %s in the errormessage will be replaced by this string.
* @author Florian Lippert <flo@syscp.org>
* @author Ron Brand <ron.brand@web.de>
*/
function standard_error($errors = '', $replacer = '')
{
global $db, $userinfo, $s, $header, $footer, $lng;
$replacer = htmlentities($replacer);
if (!is_array($errors)) {
$errors = array($errors);
}
$error = '';
foreach ($errors as $single_error) {
if (isset($lng['error'][$single_error])) {
$single_error = $lng['error'][$single_error];
$single_error = strtr($single_error, array('%s' => $replacer));
} else {
$error = 'Unknown Error (' . $single_error . '): ' . $replacer;
break;
}
if (empty($error)) {
$error = $single_error;
} else {
$error .= ' ' . $single_error;
}
}
eval("echo \"" . getTemplate('misc/error', '1') . "\";");
exit;
}
示例7: displayPage
function displayPage($name, $html_dirs = NULL)
{
global $CurrentPageName;
global $CurrentPageDirectory;
// Save name and release in globals
$CurrentPageName = $name;
// Initialize directory and type in globals
$CurrentPageDirectory = HOME_DIR;
if (!is_array($html_dirs)) {
$html_dirs = array(HOME_DIR);
}
// See if the site is offline
if (isSiteOffline()) {
getTemplate("offlineTemplate.php");
return;
}
// Make sure the page name is valid, then
// see whether the page exists and if so, where
// it is and what type it is...
if (preg_match("/^[a-z0-9\\-]*\$/i", $name)) {
foreach ($html_dirs as $dir) {
if (file_exists("{$dir}/{$name}.html")) {
$CurrentPageDirectory = "{$dir}/";
getTemplate("pageTemplate.php");
return;
}
}
}
// If we come here, display page not found
getTemplate("notfoundTemplate.php");
}
示例8: addNewUser
function addNewUser()
{
// globals
global $DB;
global $MySelf;
global $MB_EMAIL;
// Sanitize the input.
$USERNAME = $MySelf->getUsername;
$NEW_USER = strtolower(sanitize($_POST[username]));
// supplied new username.
if (!ctypeAlnum($NEW_USER)) {
makeNotice("Only characters a-z, A-Z and 0-9 are allowed as username.", "error", "Invalid Username");
}
/* Password busines */
if ($_POST[pass1] != $_POST[pass2]) {
makeNotice("The passwords did not match!", "warning", "Passwords invalid", "index.php?action=newuser", "[retry]");
}
$PASSWORD = encryptPassword("{$_POST['pass1']}");
$PASSWORD_ENC = $PASSWORD;
/* lets see if the users (that is logged in) has sufficient
* rights to create even the most basic miner. Level 3+ is
* needed.
*/
if (!$MySelf->canAddUser()) {
makeNotice("You are not authorized to do that!", "error", "Forbidden");
}
// Lets prevent adding multiple users with the same name.
if (userExists($NEW_USER) >= 1) {
makeNotice("User already exists!", "error", "Duplicate User", "index.php?action=newuser", "[Cancel]");
}
// So we have an email address?
if (empty($_POST[email])) {
// We dont!
makeNotice("You need to supply an email address!", "error", "Account not created");
} else {
// We do. Clean it.
$NEW_EMAIL = sanitize($_POST[email]);
}
// Inser the new user into the database!
$DB->query("insert into users (username, password, email, addedby, confirmed) " . "values (?, ?, ?, ?, ?)", array("{$NEW_USER}", "{$PASSWORD_ENC}", "{$NEW_EMAIL}", $MySelf->getUsername(), "1"));
// Were we successfull?
if ($DB->affectedRows() == 0) {
makeNotice("Could not create user!", "error");
} else {
// Write the user an email.
global $SITENAME;
$mail = getTemplate("newuser", "email");
$mail = str_replace('{{USERNAME}}', "{$NEW_USER}", $mail);
$mail = str_replace('{{PASSWORD}}', "{$PASSWORD}", $mail);
$mail = str_replace('{{SITE}}', "http://" . $_SERVER['HTTP_HOST'] . "/", $mail);
$mail = str_replace('{{CORP}}', "{$SITENAME}", $mail);
$mail = str_replace('{{CREATOR}}', "{$USERNAME}", $mail);
$to = $NEW_EMAIL;
$DOMAIN = $_SERVER['HTTP_HOST'];
$subject = "Welcome to MiningBuddy";
$headers = "From:" . $MB_EMAIL;
mail($to, $subject, $mail, $headers);
makeNotice("User added and confirmation email sent.", "notice", "Account created", "index.php?action=editusers");
}
}
示例9: getInput
protected function getInput()
{
global $expose;
$options = array();
$html = array();
$class = $this->element['class'];
//get template id
$id = JRequest::getInt('id');
$pretext = $this->element['pretext'] != NULL ? '<span class="pre-text hasTip" title="::' . JText::_($this->element['pre-desc'] ? $this->element['pre-desc'] : $this->description) . '">' . JText::_($this->element['pretext']) . '</span>' : '';
$posttext = $this->element['posttext'] != NULL ? '<span class="post-text">' . JText::_($this->element['posttext']) . '</span>' : '';
$wrapstart = '<div class="field-wrap clearfix ' . $class . '">';
$wrapend = '</div>';
$path = JPATH_ROOT . '/templates/' . getTemplate($id) . '/templateDetails.xml';
if (file_exists($path)) {
$xml = simplexml_load_file($path);
if (isset($xml->positions[0])) {
foreach ($xml->positions[0] as $position) {
$value = (string) $position['value'];
$label = (string) $position;
if (!$value) {
$value = $label;
}
$options[] = JHtml::_('select.option', $value, $value);
}
}
}
$html[] = JHtml::_('select.genericlist', $options, $this->name, '', 'value', 'text', $this->value, $this->id);
return $wrapstart . $pretext . implode($html) . $posttext . $wrapend;
}
示例10: passwordRequest
/**
* Generate a password reset token and email a link to the user.
*
* @return string Standard JSON envelope
*/
public function passwordRequest()
{
if (!isset($_POST['email'])) {
return $this->error('No email address provided.', false);
}
$email = $_POST['email'];
if ($email == $this->config->user->email) {
$token = md5(rand(10000, 100000));
$tokenUrl = sprintf('%s://%s/manage/password/reset/%s', $this->utility->getProtocol(false), $_SERVER['HTTP_HOST'], $token);
$this->user->setAttribute('passwordToken', $token);
$templateObj = getTemplate();
$template = sprintf('%s/email/password-reset.php', $this->config->paths->templates);
$body = $this->template->get($template, array('tokenUrl' => $tokenUrl));
$emailer = new Emailer();
$emailer->setRecipients(array($this->config->user->email));
$emailer->setSubject('Trovebox password reset request');
$emailer->setBody($body);
$result = $emailer->send();
if ($result > 0) {
return $this->success('An email was sent to reset the password.', true);
} else {
$this->logger->info('Unable to send email. Confirm that your email settings are correct and the email addresses are valid.');
return $this->error('We were unable to send a password reset email.', false);
}
}
return $this->error('The email address provided does not match the registered email for this site.', false);
}
示例11: getFormFieldOutputText
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
function getFormFieldOutputText($fieldname, $fielddata)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/text", true) . "\";");
return $returnvalue;
}
示例12: getFormFieldOutputString
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
*
* @version $Id$
*/
function getFormFieldOutputString($fieldname, $fielddata)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval('$returnvalue = "' . getTemplate('formfields/string', true) . '";');
return $returnvalue;
}
示例13: getFormFieldOutputBool
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
*
* @version $Id$
*/
function getFormFieldOutputBool($fieldname, $fielddata)
{
$label = $fielddata['label'];
$boolswitch = makeYesNo($fieldname, '1', '0', $fielddata['value']);
eval('$returnvalue = "' . getTemplate('formfields/bool', true) . '";');
return $returnvalue;
}
示例14: standard_error
/**
* Prints one ore more errormessages on screen
*
* @param array Errormessages
* @param string A %s in the errormessage will be replaced by this string.
* @author Florian Lippert <flo@syscp.org>
* @author Ron Brand <ron.brand@web.de>
*/
function standard_error($errors = '', $replacer = '')
{
global $userinfo, $s, $header, $footer, $lng, $theme;
$_SESSION['requestData'] = $_POST;
$replacer = htmlentities($replacer);
if (!is_array($errors)) {
$errors = array($errors);
}
$link = '';
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
$link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
}
$error = '';
foreach ($errors as $single_error) {
if (isset($lng['error'][$single_error])) {
$single_error = $lng['error'][$single_error];
$single_error = strtr($single_error, array('%s' => $replacer));
} else {
$error = 'Unknown Error (' . $single_error . '): ' . $replacer;
break;
}
if (empty($error)) {
$error = $single_error;
} else {
$error .= ' ' . $single_error;
}
}
eval("echo \"" . getTemplate('misc/error', '1') . "\";");
exit;
}
示例15: getFormFieldOutputString
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
function getFormFieldOutputString($fieldname, $fielddata, $do_show = true)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/string", true) . "\";");
return $returnvalue;
}