本文整理汇总了PHP中template::set_custom_template方法的典型用法代码示例。如果您正苦于以下问题:PHP template::set_custom_template方法的具体用法?PHP template::set_custom_template怎么用?PHP template::set_custom_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::set_custom_template方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
foreach ($cache->obtain_hooks() as $hook)
{
@include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
}
}
else
{
$phpbb_hook = false;
}
// Set some standard variables we want to force
$config = array(
'load_tplcompile' => '1'
);
$template->set_custom_template('../adm/style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
// the acp template is never stored in the database
$user->theme['template_storedb'] = false;
$install = new module();
$install->create('install', "index.$phpEx", $mode, $sub);
$install->load();
// Generate the page
$install->page_header();
$install->generate_navigation();
$template->set_filenames(array(
示例2: empty
${$var} = $qi_config[$var];
}
// We need some phpBB functions to.
require $phpbb_root_path . 'includes/functions.' . $phpEx;
require $phpbb_root_path . 'includes/constants.' . $phpEx;
require $phpbb_root_path . 'includes/auth.' . $phpEx;
require $phpbb_root_path . 'includes/acm/acm_file.' . $phpEx;
require $phpbb_root_path . 'includes/cache.' . $phpEx;
require $phpbb_root_path . 'includes/functions_install.' . $phpEx;
require $phpbb_root_path . 'includes/session.' . $phpEx;
require $phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx;
$mode = request_var('mode', 'main');
$qi_install = empty($qi_config) ? true : false;
// We need to set the template here.
$template = new template();
$template->set_custom_template('style', 'qi');
// Create the user.
$user = new user();
// Get and set the language.
$language = !empty($qi_config['qi_lang']) ? $qi_config['qi_lang'] : 'en';
// If there is a language selected in the dropdown menu it's sent as GET, then igonre the hidden POST field.
if (isset($_GET['lang'])) {
$language = request_var('lang', $language);
} else {
if (!empty($_POST['sel_lang'])) {
$language = request_var('sel_lang', $language);
}
}
$user->lang = file_exists($quickinstall_path . 'language/' . $language) ? $language : 'en';
qi::add_lang(array('qi', 'phpbb'), $quickinstall_path . 'language/' . $user->lang . '/');
// Probably best place to validate the settings
示例3: gettemplate
function gettemplate($files, $template = false, $template_path = false)
{
global $user;
$template_ex = '.tpl.html';
if ($template === false) {
return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex);
}
if (is_string($files)) {
// $files = array('body' => $files);
$files = array(basename($files) => $files);
}
if (!is_object($template)) {
$template = new template();
}
//$template->set_custom_template($template_path ? $template_path : TEMPLATE_DIR, TEMPLATE_NAME, TEMPLATE_DIR);
$tmpl_name = gettemplatename($user['dpath']);
$template->set_custom_template(($template_path ? $template_path : SN_ROOT_PHYSICAL . 'design/templates/') . $tmpl_name . '/', $tmpl_name, TEMPLATE_DIR);
foreach ($files as &$filename) {
$filename = $filename . $template_ex;
}
$template->set_filenames($files);
return $template;
}
示例4: get
/**
* @param string|string[] $files
* @param bool|false $template
* @param bool|false $template_path
*
* @return template
*
* (c) Gorlum 2015
*/
public static function get($files, $template = false, $template_path = false)
{
!is_object($template) ? $template = new template() : false;
//$template->set_custom_template($template_path ? $template_path : TEMPLATE_DIR, TEMPLATE_NAME, TEMPLATE_DIR);
// $tmpl_name = gettemplatename($user['dpath']);
$template->set_custom_template(($template_path ? $template_path : SN_ROOT_PHYSICAL . 'design/templates/') . DEFAULT_TEMPLATE . '/', DEFAULT_TEMPLATE, TEMPLATE_DIR);
// TODO ГРЯЗНЫЙ ХАК! Это нужно, что бы по возможности перезаписать инфу из языковых пакетов модулей там, где она была перезаписана раньше инфой из основного пакета. Почему?
// - сначала грузятся модули и их языковые пакеты
// - затем по ходу дела ОСНОВНОЙ языковой пакет может перезаписать данные из МОДУЛЬНОГО языкового пакета
// Поэтому и нужен этот грязный хак
// В норме же - страницы заявляют сами, какие им пакеты нужны. Так что сначала всегда должны грузится основные языковые пакеты, а уже ПОВЕРХ них - пакеты модулей
// global $sn_mvc, $sn_page_name;
// !empty($sn_mvc['i18n']['']) ? lng_load_i18n($sn_mvc['i18n']['']) : false;
// $sn_page_name ? lng_load_i18n($sn_mvc['i18n'][$sn_page_name]) : false;
if (!empty($files)) {
is_string($files) ? $files = array(basename($files) => $files) : false;
foreach ($files as &$filename) {
$filename = $filename . TEMPLATE_EXTENSION;
}
$template->set_filenames($files);
}
return $template;
}
示例5: get_poll
//.........这里部分代码省略.........
$db->sql_query($sql);
}
}
foreach ($currVotedID as $option) {
if (!in_array($option, $inboundVote)) {
$sql = '
UPDATE ' . POLL_OPTIONS_TABLE . '
SET poll_option_total = poll_option_total - 1
WHERE poll_option_id = ' . (int) $option . '
AND topic_id = ' . (int) $topicID;
$db->sql_query($sql);
if ($user->data['is_registered']) {
$sql = '
DELETE FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . (int) $topicID . '
AND poll_option_id = ' . (int) $option . '
AND vote_user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
}
}
}
if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot']) {
$user->set_cookie('poll_' . $topicID, implode(',', $inboundVote), time() + 31536000);
}
$sql = '
UPDATE ' . TOPICS_TABLE . '
SET poll_last_vote = ' . time() . "\n\t\t\t\t\tWHERE topic_id = {$topicID}";
$db->sql_query($sql);
$actionMsg = $user->lang['VOTE_SUBMITTED'] . '<br />';
// Reload vote state:
$pollOptions = array();
$sql = '
SELECT *
FROM ' . POLL_OPTIONS_TABLE . '
WHERE topic_id = ' . (int) $topicID;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$pollOptions[] = $row;
}
$db->sql_freeresult($result);
$currVotedID = $inboundVote;
$userCanVote = $auth->acl_get('f_votechg', $topicData['forum_id']) && $topicData['poll_vote_change'];
$displayResults = true;
}
// ***** end of vote registration ******
}
$pollTotal = 0;
foreach ($pollOptions as $pollOption) {
$pollTotal += $pollOption['poll_option_total'];
}
$pollBBCode = false;
if ($topicData['bbcode_bitfield']) {
require_once $wpUnited->get_setting('phpbb_path') . 'includes/functions_posting.' . $phpEx;
require_once $wpUnited->get_setting('phpbb_path') . 'includes/bbcode.' . $phpEx;
$pollBBCode = new bbcode();
}
for ($i = 0, $size = sizeof($pollOptions); $i < $size; $i++) {
$pollOptions[$i]['poll_option_text'] = censor_text($pollOptions[$i]['poll_option_text']);
if ($pollBBCode !== false) {
$pollBBCode->bbcode_second_pass($pollOptions[$i]['poll_option_text'], $topicData['bbcode_uid'], $topicData['bbcode_bitfield']);
}
$pollOptions[$i]['poll_option_text'] = bbcode_nl2br($pollOptions[$i]['poll_option_text']);
$pollOptions[$i]['poll_option_text'] = $phpbbForum->parse_phpbb_text_for_smilies($pollOptions[$i]['poll_option_text']);
}
$topicData['poll_title'] = $phpbbForum->censor($topicData['poll_title']);
if ($pollBBCode !== false) {
$pollBBCode->bbcode_second_pass($topicData['poll_title'], $topicData['bbcode_uid'], $topicData['bbcode_bitfield']);
}
$topicData['poll_title'] = bbcode_nl2br($topicData['poll_title']);
$topicData['poll_title'] = $phpbbForum->parse_phpbb_text_for_smilies($topicData['poll_title']);
unset($pollBBCode);
$pollEnd = $topicData['poll_length'] + $topicData['poll_start'];
$pollLength = $topicData['poll_length'] ? sprintf($user->lang[$pollEnd > time() ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($pollEnd)) : '';
$topicLink = $phpbbForum->seo ? "topic{$topicID}.html" : "viewtopic.{$phpEx}?t={$topicID}";
$pTemplate = new template();
$pTemplate->set_custom_template($wpUnited->get_plugin_path() . 'extras/quickpoll/templates/', 'wpupoll');
$pTemplate->set_filenames(array('poll' => "{$template}.html"));
$pTemplate->assign_vars(array('POLL_QUESTION' => $topicData['poll_title'], 'TOTAL_VOTES' => $pollTotal, 'POLL_LEFT_CAP_IMG' => str_replace($wpUnited->get_setting('phpbb_path'), $phpbbForum->get_board_url(), $user->img('poll_left')), 'POLL_RIGHT_CAP_IMG' => str_replace($wpUnited->get_setting('phpbb_path'), $phpbbForum->get_board_url(), $user->img('poll_right')), 'POLL_ID' => $topicID, 'L_MAX_VOTES' => $topicData['poll_max_options'] == 1 ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topicData['poll_max_options']), 'L_POLL_LENGTH' => $actionMsg . $pollLength, 'POLL_TEMPLATE' => $template, 'S_CAN_VOTE' => $userCanVote, 'S_DISPLAY_RESULTS' => $displayResults, 'S_SHOW_LINK' => $showLink, 'U_TOPIC_LINK' => $phpbbForum->get_board_url() . $topicLink, 'L_TOPIC_LINK' => __('View poll in forum', 'wp-united'), 'S_IS_MULTI_CHOICE' => $topicData['poll_max_options'] > 1 ? true : false, 'S_POLL_ACTION' => $currURL, 'U_VIEW_RESULTS' => !strstr($currURL, '?') ? $currURL . '?wpupolldisp=1' : $currURL . '&wpupolldisp=1'));
foreach ($pollOptions as $pollOption) {
$optionPct = $pollTotal > 0 ? $pollOption['poll_option_total'] / $pollTotal : 0;
$optionPctTxt = sprintf("%.1d%%", round($optionPct * 100));
$pTemplate->assign_block_vars('poll_option', array('POLL_OPTION_ID' => $pollOption['poll_option_id'], 'POLL_OPTION_CAPTION' => $pollOption['poll_option_text'], 'POLL_OPTION_RESULT' => $pollOption['poll_option_total'], 'POLL_OPTION_PERCENT' => $optionPctTxt, 'POLL_OPTION_PCT' => round($optionPct * 100), 'POLL_OPTION_IMG' => str_replace($wpUnited->get_setting('phpbb_path'), $phpbbForum->get_board_url(), $user->img('poll_center', $optionPctTxt, round($optionPct * 250))), 'POLL_OPTION_VOTED' => in_array($pollOption['poll_option_id'], $currVotedID) ? true : false));
}
ob_start();
$pTemplate->display('poll');
$pollMarkup = ob_get_contents();
unset($pTemplate);
ob_end_clean();
$phpbbForum->restore_state($fStateChanged);
if ($ajax) {
wpu_ajax_header();
echo '<wpupoll>';
echo '<newnonce>' . wp_create_nonce('wpu-poll-submit') . '</newnonce>';
echo '<pollid>' . $topicID . '</pollid>';
echo '<markup><![CDATA[' . base64_encode($pollMarkup) . ']]></markup>';
echo '</wpupoll>';
exit;
}
return $pollMarkup;
}
示例6: gettemplate
function gettemplate($templatename, $is_phpbb = false)
{
$templatename .= '.tpl';
if ($is_phpbb) {
$template = new template();
$template->set_custom_template(TEMPLATE_DIR, TEMPLATE_NAME);
$template->set_filenames(array('body' => $templatename));
return $template;
} else {
return ReadFromFile(TEMPLATE_DIR . '/' . $templatename);
}
}
示例7: template
<?php
/**
* @author John "JohnMaguire2013" Maguire <john@leftforliving.com>
* @package BitLuck
* @version 0.3
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License
*/
/* Include configuration */
require_once 'config.inc.php';
/* Include the template engine and set it up */
require_once 'classes/template.php';
$template = new template();
$template->set_custom_template('templates', 'default');
/* Find the pot size to entice viewers */
try {
$pot_size = number_format($bc->getbalance("Lottery Pot"), 2) . " BTC";
} catch (Exception $e) {
if ($debug) {
echo "EXCEPTION: " . $e->getMessage();
} else {
die("Sorry, an error occured and we cannot continue processing this page.");
}
}
/* Site name */
$template->assign_vars(array('SITENAME' => 'BitLuck', 'DONATE' => '16nCPK6mx4WxSzbAQQCU7Sh9XTzDHDwB63', 'TOTALPOT' => $pot_size, 'OWNERPERCENTAGE' => $owner_fee * 100, 'WINNERPERCENTAGE' => 100 - $owner_fee * 100, 'DRAWTIME' => $draw_time, 'COST' => $ticket_cost));
/* Load up the header to be used on each page */
$template->set_filenames(array('header' => 'site_header.html'));
if (isset($_POST['submit'])) {
/* Check if the address was valid */
try {