本文整理汇总了PHP中Template函数的典型用法代码示例。如果您正苦于以下问题:PHP Template函数的具体用法?PHP Template怎么用?PHP Template使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Msg
function Msg($msg)
{
$smarty = Template();
$smarty->assign('msg', $msg);
$smarty->display('msg.tpl');
die;
}
示例2: display
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
## Include functions for Bootstrap: (template choice)
include_once 'components/com_ticketmaster/assets/functions.php';
$filter_order = $mainframe->getUserStateFromRequest('filter_ordering', 'filter_ordering_t', 'a.ticketdate', 'cmd');
## Model is defined in the controller
$model = $this->getModel();
## Getting the items into a variable
$items = $this->get('list');
$data = $this->get('data');
$pagination = $this->get('pagination');
$config = $this->get('config');
$javascript = 'onchange="document.adminForm.submit();"';
## Filling the Array() for doors and make a select list for it.
$ordering = array('a.price' => array('value' => 'a.ticketprice', 'text' => JText::_('COM_TICKETMASTER_ORDER_PRICE')), 'a.ticketdate' => array('value' => 'a.ticketdate', 'text' => JText::_('COM_TICKETMASTER_ORDER_DATE')), 'a.totaltickets' => array('value' => 'a.totaltickets', 'text' => JText::_('COM_TICKETMASTER_AVAILEBILLITY')));
$lists['ordering'] = JHTML::_('select.genericList', $ordering, 'filter_ordering_t', ' class="inputbox" ' . $javascript, 'value', 'text', $filter_order);
## Showing default template or bootstrap?
$tpl = Template($config->load_bootstrap);
$uri = JFactory::getURI();
$this->assignRef('items', $items);
$this->assignRef('config', $config);
$this->assignRef('lists', $lists);
$this->assignRef('data', $data);
$this->assignRef('pagination', $pagination);
$this->assign('action', $uri->toString());
$this->assign('ordering', $filter_order);
parent::display($tpl);
}
示例3: actionPage
function actionPage(&$request, $action)
{
global $WikiTheme;
$pagename = $request->getArg('pagename');
$version = $request->getArg('version');
$page = $request->getPage();
$revision = $page->getCurrentRevision();
$dbi = $request->getDbh();
$actionpage = $dbi->getPage($action);
$actionrev = $actionpage->getCurrentRevision();
$pagetitle = HTML(fmt("%s: %s", $actionpage->getName(), $WikiTheme->linkExistingWikiWord($pagename, false, $version)));
$validators = new HTTP_ValidatorSet(array('pageversion' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
$request->appendValidators(array('pagerev' => $revision->getVersion(), '%mtime' => $revision->get('mtime')));
$request->appendValidators(array('actionpagerev' => $actionrev->getVersion(), '%mtime' => $actionrev->get('mtime')));
$transformedContent = $actionrev->getTransformedContent();
$template = Template('browse', array('CONTENT' => $transformedContent));
/*
if (!headers_sent()) {
//FIXME: does not work yet. document.write not supported (signout button)
// http://www.w3.org/People/mimasa/test/xhtml/media-types/results
if (ENABLE_XHTML_XML
and (!isBrowserIE() and
strstr($request->get('HTTP_ACCEPT'),'application/xhtml+xml')))
header("Content-Type: application/xhtml+xml; charset=" . $GLOBALS['charset']);
else
header("Content-Type: text/html; charset=" . $GLOBALS['charset']);
}
*/
GeneratePage($template, $pagetitle, $revision);
$request->checkValidators();
flush();
}
示例4: header
function header()
{
global $HTML, $group_id, $group_public_name, $request, $project;
$pagename = $request->getArg('pagename');
$submenu = Template('navbar');
//group is private
if (!$project->isPublic()) {
//if it's a private group, you must be a member of that group
session_require_perm('project_read', $group_id);
}
//for dead projects must be member of admin project
if (!$project->isActive()) {
//only SF group can view non-active, non-holding groups
session_require_global_perm('forge_admin');
}
$HTML->header(array('title' => $group_public_name . ': ' . htmlspecialchars($pagename), 'group' => $group_id, 'toptab' => 'wiki', 'submenu' => $submenu->asXML()));
// Display a warning banner for internal users when the wiki is opened
// to external users.
if ($project->getIsExternal()) {
$external_user = false;
if (session_loggedin()) {
$user = session_get_user();
$external_user = $user->getIsExternal();
}
if (!$external_user) {
$page = $request->getPage();
if ($page->get('external')) {
$external_msg = _("This page is external.");
}
echo $HTML->warning_msg(_("This project is shared with third-party users (non Alcatel-Lucent users).") . (isset($external_msg) ? ' ' . $external_msg : ''));
}
}
}
示例5: flashPlayer
/**
* Function used to display flash player for ClipBucket video
*/
function flashPlayer($param)
{
global $Cbucket, $swfobj;
$param['player_div'] = $param['player_div'] ? $param['player_div'] : 'videoPlayer';
$key = $param['key'];
$flv = $param['flv'] . '.flv';
$code = $param['code'];
$flv_url = $file;
$embed = $param['embed'];
$code = $param['code'];
$height = $param['height'] ? $param['height'] : config('player_height');
$width = $param['width'] ? $param['width'] : config('player_width');
$param['height'] = $height;
$param['width'] = $width;
$param['enlarge_button'] = config('enlarge_button');
$param['player_logo_url'] = config('player_logo_url');
//dump($code);
if (!$param['autoplay']) {
$param['autoplay'] = config('autoplay_video');
}
assign('player_params', $param);
if (count($Cbucket->actions_play_video) > 0) {
foreach ($Cbucket->actions_play_video as $funcs) {
if (function_exists($funcs)) {
$func_data = $funcs($param);
}
if ($func_data) {
$player_code = $func_data;
$show_player = true;
break;
}
}
}
if (function_exists('cbplayer') && empty($player_code)) {
$player_code = cbplayer($param, true);
} elseif (function_exists('cbplayer')) {
return $player_code;
}
global $pak_player;
if ($player_code) {
if (!$pak_player && $show_player && !is_bool($player_code)) {
assign("player_js_code", $player_code);
Template(PLAYER_DIR . '/player.html', false);
return false;
} else {
return false;
}
}
return blank_screen($param);
}
示例6: cb_player
function cb_player($in)
{
global $cb_player;
$cb_player = true;
$vdetails = $in['vdetails'];
$vid_file = get_video_file($vdetails, true, true);
//Checking for YT Referal
if (function_exists('get_refer_url_from_embed_code')) {
$ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code'])));
$ytcode = $ref_details['ytcode'];
}
if ($vid_file || $ytcode) {
$hd = $data['hq'];
if ($hd == 'yes') {
$file = get_hq_video_file($vdetails);
} else {
$file = get_video_file($vdetails, true, true);
}
$hd_file = get_hq_video_file($vdetails);
if ($ytcode) {
assign('youtube', true);
assign('ytcode', $ytcode);
}
if (!strstr($in['width'], "%")) {
$in['width'] = $in['width'] . 'px';
}
if (!strstr($in['height'], "%")) {
$in['height'] = $in['height'] . 'px';
}
if ($in['autoplay'] == 'yes' || $in['autoplay'] === true || $_COOKIE['auto_play_playlist'] && ($_GET['play_list'] || $_GET['playlist'])) {
$in['autoplay'] = true;
} else {
$in['autoplay'] = false;
}
//Logo Placement
assign('logo_placement', cb_player_logo_position());
assign('logo_margin', config('logo_padding'));
//Setting Skin
assign('cb_skin', 'glow/glow.xml');
assign('player_data', $in);
assign('player_logo', website_logo());
assign('normal_vid_file', $vid_file);
assign("hq_vid_file", $hd_file);
assign('vdata', $vdetails);
Template(CB_PLAYER_DIR . '/cbplayer.html', false);
return true;
}
}
示例7: StartLoadDump
function StartLoadDump(&$request, $title, $html = '')
{
// MockRequest is from the unit testsuite, a faked request. (may be cmd-line)
// We are silent on unittests.
if (isa($request, 'MockRequest')) {
return;
}
// FIXME: This is a hack. This really is the worst overall hack in phpwiki.
if ($html) {
$html->pushContent('%BODY%');
}
$tmpl = Template('html', array('TITLE' => $title, 'HEADER' => $title, 'CONTENT' => $html ? $html : '%BODY%'));
echo ereg_replace('%BODY%.*', '', $tmpl->getExpansion($html));
$request->chunkOutput();
// set marker for sendPageChangeNotification()
$request->_deferredPageChangeNotification = array();
}
示例8: cb_video_player
/**
* Loads ClipBucket players...
*
* @global type $Cbucket
* @global type $swfobj
* @param type $param
* @return boolean
*
* @todo Write documentation on this function..
*/
function cb_video_player($param)
{
global $Cbucket, $swfobj;
$param['player_div'] = $param['player_div'] ? $param['player_div'] : 'videoPlayer';
$key = $param['key'];
$code = $param['code'];
$flv_url = $file;
$embed = $param['embed'];
$code = $param['code'];
$height = $param['height'] ? $param['height'] : config('player_height');
$width = $param['width'] ? $param['width'] : config('player_width');
$param['height'] = $height;
$param['width'] = $width;
if (!$param['autoplay']) {
$param['autoplay'] = config('autoplay_video');
}
if (!$param['files']) {
global $cbvid;
$files = $cbvid->get_video_files($param['video']);
$param['files'] = $files;
}
assign('player_params', $param);
$param = apply_filters($param, 'play_video');
//Calling actions for play_video
$output = call_actions('play_video', $param);
if ($output) {
$player_code = $output;
return $output;
}
if (function_exists('cbplayer') && empty($player_code)) {
$player_code = cbplayer($param, true);
}
if ($player_code) {
if (!$pak_player && $show_player) {
assign("player_js_code", $player_code);
Template(PLAYER_DIR . '/player.html', false);
return false;
} else {
return false;
}
}
return blank_screen($param);
}
示例9: cb_video_js
function cb_video_js($in)
{
global $cb_video_js;
$cb_video_js = true;
$vdetails = $in['vdetails'];
$video_play = get_video_files($vdetails, true, true);
if (!strstr($in['width'], "%")) {
$in['width'] = $in['width'] . 'px';
}
if (!strstr($in['height'], "%")) {
$in['height'] = $in['height'] . 'px';
}
assign('height', $in['height']);
assign('width', $in['width']);
assign('player_config', $in);
assign('vdata', $vdetails);
assign('cb_logo', cb_logo());
assign('video_files', $video_play);
Template(CB_VJS_PLAYER_DIR . '/cb_video_js.html', false);
return true;
}
示例10: compile
/**
* Compiles code for the {extends} tag
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @return string compiled code
*/
public function compile($args, $compiler)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
if (strpos($_attr['file'], '$_tmp') !== false) {
$compiler->trigger_template_error('illegal value for file attribute', $compiler->lex->taglineno);
}
$_smarty_tpl = $compiler->template;
$name = $_attr['file'];
if ($name[0] === "'" && $name[strlen($name) - 1] === "'") {
$name = '"' . substr($name, 1, -1) . '"';
}
$tpl_name = json_decode($name);
// create template object
$_template = Template($tpl_name, $compiler->smarty, $compiler->template);
// check for recursion
$uid = $_template->source->uid;
if (isset($compiler->extends_uid[$uid])) {
$compiler->trigger_template_error("illegal recursive call of \"{$name}\"", $this->lex->line - 1);
}
$compiler->extends_uid[$uid] = true;
if (empty($_template->source->components)) {
array_unshift($compiler->sources, $_template->source);
} else {
foreach ($_template->source->components as $source) {
array_unshift($compiler->sources, $source);
$uid = $source->uid;
if (isset($compiler->extends_uid[$uid])) {
$compiler->trigger_template_error("illegal recursive call of \"{$source->filepath}\"", $this->lex->line - 1);
}
$compiler->extends_uid[$uid] = true;
}
}
unset($_template);
$compiler->inheritance_child = true;
$compiler->lex->yypushstate(\Box\Brainy\Compiler\Lexer::CHILDBODY);
return '';
}
示例11: load_remote_upload_form
function load_remote_upload_form($params = NULL)
{
global $file_name;
assign('params', $params);
Template(STYLES_DIR . '/global/remote_upload_form.html', false);
return false;
echo '<div class="alert alert-info marginTop">
' . lang('upload_remote_video_msg') . '
</div>';
echo '<div class="upload_form_div clearfix form-group' . $class . '" id="remoteUploadFormDiv">
<label for="remote_file_url" class="label">' . lang('please_enter_remote_file_url') . '</label>
<input name="remote_file_url" type="textfield" class="remoteUrlInput form-control"
id="remote_file_url" value="' . lang('remote_upload_example') . '"
onclick="if($(this).val()==\'' . lang('remote_upload_example') . '\') $(this).val(\'\')"/>
<input name="submit_upload" type="hidden" value="' . lang('upload_data_now') . '">
<div id="remote_upload_result_cont"></div>
<div class="remote_main_bar" id="main_bar">
<div id="prog_bar" class="remote_prog_bar"></div>
</div>
<div align="center" id="loading" style="margin:5px 0px"></div>
<div>
' . lang('remoteDownloadStatusDiv') . '
</div>
<div align="right">
<input type="button" name="ytUploadBttn" id="ytUploadBttn"
value="' . lang('grab_from_youtube') . '" onClick="youtube_upload()" class="cbSubmitUpload">
<input type="button" name="remoteUploadBttn" id="remoteUploadBttn" value="' . lang('upload') . '"
onClick="_cb.' . get_remote_url_function() . '" class="cbSubmitUpload">
<input type="button" name="remoteUploadBttnStop" id="remoteUploadBttnStop" value="' . lang('cancel') . '"
class="cbSubmitUpload" style="display:none"/>
</div>
</div>
<div id="remoteForm"></div> ';
}
示例12: mysql_fetch_array
$Record2 = mysql_fetch_array($DataSet2);
$gcp_nb = $Record2["gcp_nb"];
$nb_max_product = pow(10, 12 - $length);
$perc_num = $nb_rc_0 / $nb_num * 100;
$perc = number_format($perc_num, 2, '.', ' ');
$nb = number_format($nb_num, 0, '.', ' ');
$nb_rc_0 = number_format($nb_rc_0, 0, '.', ' ');
$nb_max_product = number_format($nb_max_product, 0, '.', ' ');
if ($gcp_nb == $nb_num) {
// if all gcp have been checked, green background
$style_nb = 'background-color:rgb(190, 247, 190);';
} else {
if ($length > 7) {
$style_nb = 'background-color:rgb(213, 211, 211);';
} else {
$style_nb = '';
}
}
if ($perc_num > 2) {
$style_perc = '';
} else {
$style_perc = 'color:red;';
}
$Corps .= Template("template-stats-gcp-length", 2, $Params = array("VALUE_PREFIX" => $prefix, "VALUE_LENGTH" => $length, "VALUE_NB_NUM" => $nb_num, "VALUE_NB" => $nb, "VALUE_NB_RC_0" => $nb_rc_0, "VALUE_PREFIX_NM" => $prefix_nm, "VALUE_COUNTRY" => $country, "VALUE_GCP_NB" => $gcp_nb, "VALUE_NB_MAX_PRODUCT" => $nb_max_product, "VALUE_PERC_NUM" => $perc_num, "VALUE_PERC" => $perc, "VALUE_STYLE_NB" => $style_nb, "VALUE_STYLE_PERC" => $style_perc, "VALUE_IMG_COUNTRY" => DOSSIER_IMG_COUNTRY . strtolower($country)));
}
$Corps .= Template("template-stats-gcp-length", 3, $Params = array());
$FileName = $DataFolder . "stats-gcp-length.html";
$file = fopen($FileName, 'w');
fputs($file, $Corps);
fclose($file);
echo "File generated<hr/>";
示例13: while
$data['work'] = '<font color="#990000">Kein Style angelegt.</font>';
} else {
$data['work'] .= '<a href="style.php?action=publicStyle&styleid=all">Alle als öffendlich makieren</a> |
<a href="style.php?action=publicStyle&styleid=no">Alle als nicht öffendlich makieren</a><br /><br />
<table cellpadding="3" cellspacing="0" border="0">';
while ($list = db_result($r_list)) {
$data['work'] .= '<tr>
<td>' . $list['stylename'] . '</td>
<td> </td>
<td><font color="#FF0000">' . ($list['styleisdefault'] == 1 ? '*' : ' ') . '</font></td>
<td><font color="#0000FF">' . ($list['styleispublic'] == 1 ? '*' : ' ') . '</font></td>
<td> </td>
<td>
<a href="style.php?action=editStyle&styleid=' . $list['styleid'] . '">Editieren</a> |
<a href="style.php?action=deleStyle&styleid=' . $list['styleid'] . '">Löschen</a> |
<a href="style.php?action=defaultStyle&styleid=' . $list['styleid'] . '">Als global makieren</a> |
<a href="style.php?action=exStyle&styleid=' . $list['styleid'] . '">Exportieren</a>
</td>
</tr>';
}
$data['work'] .= '</table><br /><br />
<font color="#FF0000">*</font> Globaler Style. Dieser Wird auf der Indexseite und in allen Foren genutzt, es sei denn
für ein Forum<br /> ist ein anderer Style makiert.<br /><br />
<font color="#0000FF">*</font> Öffendlicher Style. Diese Styles können vom User im Profil ausgewählt werden.<br />
Dann wird für ihn das gesammte Board mit diesem Style angezeigt.
';
}
}
$data['javascript'] = '';
echo Template(Get_Template('templates/admin.html'));
tb_footer();
示例14: handleAction
function handleAction()
{
$action = $this->getArg('action');
if ($this->isPost() and !$this->_user->isAdmin() and $action != 'browse') {
$page = $this->getPage();
if ($page->get('moderation')) {
require_once "lib/WikiPlugin.php";
$loader = new WikiPluginLoader();
$plugin = $loader->getPlugin("ModeratedPage");
if ($plugin->handler($this, $page)) {
$CONTENT = HTML::div(array('class' => 'wiki-edithelp'), fmt("%s: action forwarded to a moderator.", $action), HTML::br(), _("This action requires moderator approval. Please be patient."));
if (!empty($plugin->_tokens['CONTENT'])) {
$plugin->_tokens['CONTENT']->pushContent(HTML::br(), _("You must wait for moderator approval."));
} else {
$plugin->_tokens['CONTENT'] = $CONTENT;
}
require_once "lib/Template.php";
$title = WikiLink($page->getName());
$title->pushContent(' : ', WikiLink(_("ModeratedPage")));
GeneratePage(Template('browse', $plugin->_tokens), $title, $page->getCurrentRevision());
$this->finish();
}
}
}
$method = "action_{$action}";
if (method_exists($this, $method)) {
$this->{$method}();
} elseif ($page = $this->findActionPage($action)) {
$this->actionpage($page);
} else {
$this->finish(fmt("%s: Bad action", $action));
}
}
示例15: display_user_custom_background
/**
* This function includes the file containing user custom background
* if uploaded. This code should run after opening html <body> tag.
* This will spread the background cross the window.
*
* @global OBJECT $userquery
* @param MIX $uid
* @return custom_background.html Template
*/
function display_user_custom_background($uid = null)
{
global $userquery;
if (is_null($uid)) {
return false;
}
if (is_numeric($uid)) {
$user = $userquery->get_user_details($uid);
} else {
$user = $uid;
}
if (empty($user)) {
return false;
}
assign('u', $user);
Template(STYLES_DIR . '/global/blocks/view_channel/custom_background.html', false);
}