本文整理汇总了PHP中phpbb\template\template::assign_var方法的典型用法代码示例。如果您正苦于以下问题:PHP template::assign_var方法的具体用法?PHP template::assign_var怎么用?PHP template::assign_var使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\template\template
的用法示例。
在下文中一共展示了template::assign_var方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify_template_vars
/**
* Show a message if can't view topics
*
* @param object $event The event object
* @return null
* @access public
*/
public function modify_template_vars($event)
{
if (!$this->auth->acl_get('f_topic_view', $event['forum_id'])) {
$this->user->add_lang_ext('rmcgirr83/topicrestriction', 'common');
$this->template->assign_var('S_CAN_VIEW_TOPICS', true);
}
}
示例2: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
if (isset($this->config['board3_clock_src_' . $module_id]) && !empty($this->config['board3_clock_src_' . $module_id])) {
$this->template->assign_var('B3P_CLOCK_SRC', $this->config['board3_clock_src_' . $module_id]);
}
return 'clock_side.html';
}
示例3: page_header
/**
* Update the template variables
*
* @param object $event The event object
* @return null
* @access public
*/
public function page_header($event)
{
// Let's try and set the base language, if not default to 'en'
$lang_array = array('af', 'sq', 'ar', 'hy', 'az', 'eu', 'be', 'bn', 'bs', 'bg', 'my', 'ca', 'ceb', 'zh-CN', 'zh-TW', 'hr', 'cs', 'da', 'nl', 'en', 'eo', 'et', 'tl', 'fi', 'fr', 'gl', 'ka', 'de', 'el', 'gu', 'ht', 'ha', 'iw', 'hi', 'hmn', 'hu', 'is', 'ig', 'id', 'ga', 'it', 'ja', 'jv', 'kn', 'kk', 'km', 'ko', 'lo', 'la', 'lv', 'lt', 'mk', 'mg', 'ms', 'ml', 'mt', 'mi', 'mr', 'mn', 'no', 'ny', 'fa', 'pl', 'pt', 'pa', 'ro', 'ru', 'sr', 'si', 'sk', 'sl', 'so', 'es', 'su', 'sw', 'sv', 'tg', 'ta', 'te', 'th', 'tr', 'uk', 'ur', 'uz', 'vi', 'cy', 'yi', 'yo', 'zu');
$base_lang = in_array($this->config['default_lang'], $lang_array) ? $this->config['default_lang'] : 'en';
$this->template->assign_var('BASE_LANG', $base_lang);
}
示例4: display_topics
/**
* Display support topics from all contributions or of a specific type.
*
* @param string $type Contribution type's string identifier
* @return \Symfony\Component\HttpFoundation\Response
*/
public function display_topics($type)
{
$type_id = $this->get_type_id($type);
if ($type_id === false) {
return $this->helper->error('NO_PAGE', 404);
}
if ($type == 'all') {
// Mark all topics read
if ($this->request->variable('mark', '') == 'topics') {
$this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT);
}
// Mark all topics read
$this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics')));
}
$this->display->assign_global_vars();
$u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all'));
$this->template->assign_var('U_ALL_SUPPORT', $u_all_support);
// Generate the main breadcrumbs
$this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support));
// Links to the support topic lists
foreach ($this->types->get_all() as $id => $class) {
$this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs));
}
$data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id));
// Canonical URL
$data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type)));
$this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical());
return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE');
}
示例5: modify_template_vars
/**
* Show a message if can't post without approval
*
* @param object $event The event object
* @return null
* @access public
*/
public function modify_template_vars($event)
{
if ($this->check_auth($event['forum_id'])) {
$this->user->add_lang_ext('rmcgirr83/newtopicsneedapproval', 'common');
$this->template->assign_var('S_REQUIRES_APPROVAL', true);
}
}
示例6: get_holiday_config
/**
* Get config var
*
* @return null
* @access public
*/
public function get_holiday_config()
{
/* XMAS Start */
$this->template->assign_var('S_ENABLE_XMAS', $this->config['enable_xmas']);
/* XMAS Stop */
/* VALENTINE Start */
$this->template->assign_var('S_ENABLE_VALENTINE', $this->config['enable_valentine']);
/* VALENTINE Stop */
}
示例7: initContaoLayout
/**
* Load and set Layout Sections during
* early phpbb page / template processing
*
* @param Event $event
*/
public function initContaoLayout(data $event)
{
// Load dynamic rendered layout sections
// and syncs session for loggedin users
$sections = $this->contaoConnector->loadLayout();
if (isset($sections->overall_header)) {
$this->template->assign_var('CONTAO_LAYOUT_HEADER', $sections->overall_header);
}
if (isset($sections->overall_footer)) {
$this->template->assign_var('CONTAO_LAYOUT_FOOTER', $sections->overall_footer);
}
}
示例8: show
public function show()
{
$this->phpbb_container->get('blitze.sitemaker.util')->add_assets(array('css' => array('@blitze_sitemaker/vendor/fontawesome/css/font-awesome.min.css')));
$this->template->assign_var('L_INDEX', $this->user->lang('HOME'));
if ($this->page_can_have_blocks()) {
$edit_mode = $this->toggle_edit_mode();
$display_mode = $this->get_display_modes();
$u_edit_mode = $this->get_edit_mode_url($edit_mode, $display_mode);
$this->show_blocks($edit_mode, $display_mode);
$this->template->assign_vars(array('S_SITEMAKER' => true, 'U_EDIT_MODE' => $u_edit_mode));
}
}
示例9: display
/**
* Display blocks for current route
*
* @param bool $edit_mode
* @param array $route_info
* @param int $style_id
* @param $display_modes
*/
public function display($edit_mode, array $route_info, $style_id, array $display_modes)
{
$ex_positions = $route_info['ex_positions'];
$users_groups = $this->groups->get_users_groups();
$positions = $this->get_blocks_for_route($route_info, $style_id, $edit_mode);
$blocks_per_position = array();
foreach ($positions as $position => $blocks) {
$pos_count_key = "s_{$position}_count";
$blocks_per_position[$pos_count_key] = 0;
$this->show_position($position, $blocks, $ex_positions, $users_groups, $blocks_per_position[$pos_count_key], $display_modes, $edit_mode);
}
$this->template->assign_var('S_HAS_BLOCKS', sizeof($positions));
$this->template->assign_vars(array_change_key_case($blocks_per_position, CASE_UPPER));
}
示例10: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
$style_count = 0;
$style_select = '';
$sql = 'SELECT style_id, style_name
FROM ' . STYLES_TABLE . '
WHERE style_active = 1
ORDER BY LOWER(style_name) ASC';
$result = $this->db->sql_query($sql, 3600);
while ($row = $this->db->sql_fetchrow($result)) {
$style = $this->request->variable('style', 0);
if (!empty($style)) {
$url = str_replace('style=' . $style, 'style=' . $row['style_id'], $this->modules_helper->route('board3_portal_controller'));
} else {
$url = $this->modules_helper->route('board3_portal_controller') . '?style=' . $row['style_id'];
}
++$style_count;
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $this->user->style['style_id'] ? ' selected="selected"' : '') . '>' . utf8_htmlspecialchars($row['style_name']) . '</option>';
}
$this->db->sql_freeresult($result);
if (strlen($style_select)) {
$this->template->assign_var('STYLE_SELECT', $style_select);
}
// Assign specific vars
$this->template->assign_vars(array('S_STYLE_OPTIONS' => $this->config['override_user_style'] || $style_count < 2 ? '' : $style_select));
return 'stylechanger_side.html';
}
示例11: array
function acp_page($id, &$module)
{
$captcha_vars = array(self::$CONFIG_SITEKEY => 'RECAPTCHA2_SITEKEY', self::$CONFIG_SECRETKEY => 'RECAPTCHA2_SECRETKEY');
$module->tpl_name = '@gothick_recaptcha2/captcha_recaptcha2_acp';
$module->page_title = 'ACP_VC_SETTINGS';
$form_key = 'acp_captcha';
add_form_key($form_key);
if ($this->request->is_set_post('submit') && check_form_key($form_key)) {
$captcha_vars = array_keys($captcha_vars);
foreach ($captcha_vars as $captcha_var) {
$value = $this->request->variable($captcha_var, '');
if ($value) {
$this->config->set($captcha_var, $value);
}
}
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_CONFIG_VISUAL');
trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($module->u_action));
} else {
if ($this->request->is_set_post('submit')) {
trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($module->u_action));
}
}
foreach ($captcha_vars as $captcha_var => $template_var) {
$var = $this->request->is_set_post($captcha_var) ? $this->request->variable($captcha_var, '') : (isset($this->config[$captcha_var]) ? $this->config[$captcha_var] : '');
$this->template->assign_var($template_var, $var);
}
$this->template->assign_vars(array('CAPTCHA_PREVIEW' => $this->get_demo_template($id), 'CAPTCHA_NAME' => $this->get_service_name(), 'U_ACTION' => $module->u_action));
}
示例12: add_user_form_group
/**
* {@inheritdoc}
*/
public function add_user_form_group($title, $form)
{
$this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form));
$this->template->assign_block_vars('options', array('LEGEND' => $this->language->lang($title), 'S_LEGEND' => true));
foreach ($form as $input_name => $input_options) {
if (!isset($input_options['type'])) {
continue;
}
$tpl_ary = array();
$tpl_ary['TYPE'] = $input_options['type'];
$tpl_ary['TITLE'] = $this->language->lang($input_options['label']);
$tpl_ary['KEY'] = $input_name;
$tpl_ary['S_EXPLAIN'] = false;
if (isset($input_options['default'])) {
$default = $input_options['default'];
$default = preg_replace_callback('#\\{L_([A-Z0-9\\-_]*)\\}#s', array($this, 'lang_replace_callback'), $default);
$tpl_ary['DEFAULT'] = $default;
}
if (isset($input_options['description'])) {
$tpl_ary['TITLE_EXPLAIN'] = $this->language->lang($input_options['description']);
$tpl_ary['S_EXPLAIN'] = true;
}
if (in_array($input_options['type'], array('select', 'radio'))) {
for ($i = 0, $total = sizeof($input_options['options']); $i < $total; $i++) {
if (isset($input_options['options'][$i]['label'])) {
$input_options['options'][$i]['label'] = $this->language->lang($input_options['options'][$i]['label']);
}
}
$tpl_ary['OPTIONS'] = $input_options['options'];
}
$this->template->assign_block_vars('options', $tpl_ary);
}
$this->template->set_filenames(array('form_install' => 'installer_form.html'));
$this->form = $this->template->assign_display('form_install');
}
示例13: news_overview
/**
* Display all channels and news
*
* @return void
* @access public
*/
public function news_overview()
{
// Catch all channels from the database
$csql = 'SELECT c.channel_id, g.group_name, c.channel_name, c.vRefresh FROM phpbb_consim_news_channel c INNER JOIN ' . GROUPS_TABLE . ' g ON c.group_id = g.group_id';
$cresult = $this->db->sql_query($csql);
while ($crow = $this->db->sql_fetchrow($cresult)) {
$this->template->assign_block_vars('allChannels', array('GROUP' => isset($this->user->lang['G_' . $crow['group_name']]) ? $this->user->lang['G_' . $crow['group_name']] : $crow['group_name'], 'CHANNELNAME' => $crow['channel_name'], 'VREFRESH' => $crow['vRefresh'] == 1 ? $this->user->lang['YES'] : $this->user->lang['NO'], 'EDITCHANNEL' => build_url("action") . "&action=edit_channel&channel_id=" . $crow['channel_id']));
}
// Add link to add a channel
$this->template->assign_var('ADDCHANNEL', build_url("action") . "&action=add_channel");
// Catch all topics from the database
$tsql = 'SELECT topic_id, topic_name FROM phpbb_consim_news_topics';
$tresult = $this->db->sql_query($tsql);
while ($trow = $this->db->sql_fetchrow($tresult)) {
$this->template->assign_block_vars('allTopics', array('TOPICID' => $trow['topic_id'], 'DELETETOPIC' => build_url("action") . '&action=delete_topic&topic_id=' . $trow['topic_id'], 'NAME' => $trow['topic_name']));
}
// Catch all news from the database
$nsql = "SELECT n.news_id, n.content, c.channel_name, t.topic_name FROM phpbb_consim_news n\n\t\t\tINNER JOIN phpbb_consim_news_channel c ON n.channel_id = c.channel_id\n\t\t\tINNER JOIN phpbb_consim_news_topics t ON n.topic_id = t.topic_id\n\t\t\tORDER BY news_id ASC";
$nresult = $this->db->sql_query($nsql);
while ($nrow = $this->db->sql_fetchrow($nresult)) {
$this->template->assign_block_vars('NewsBlock', array('CONTENT' => $nrow['content'], 'CHANNEL' => $nrow['channel_name'], 'TOPIC' => $nrow['topic_name'], 'EDITNEWS' => build_url("action") . "&action=edit_news&news_id=" . $nrow['news_id']));
}
// Add link to add a news
$this->template->assign_var('ADDNEWS', build_url("action") . "&action=add_news");
}
示例14: details
/**
* Display author details page.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function details()
{
$this->author->get_rating();
// Canonical URL
$this->template->assign_var('U_CANONICAL', $this->author->get_url());
return $this->helper->render('authors/author_details.html', $this->get_title('AUTHOR_DETAILS'));
}
示例15: show_installed
/**
* List installed styles
*/
protected function show_installed()
{
// Get all installed styles
$styles = $this->get_styles();
if (!count($styles)) {
trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
usort($styles, array($this, 'sort_styles'));
// Get users
$users = $this->get_users();
// Add users counter to rows
foreach ($styles as &$style) {
$style['_users'] = isset($users[$style['style_id']]) ? $users[$style['style_id']] : 0;
}
// Set up styles list variables
// Addons should increase this number and update template variable
$this->styles_list_cols = 4;
$this->template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols);
// Show styles list
$this->show_styles_list($styles, 0, 0);
// Show styles with invalid inherits_id
foreach ($styles as $style) {
if (empty($style['_shown'])) {
$style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree']));
$this->list_style($style, 0);
}
}
// Add buttons
$this->template->assign_block_vars('extra_actions', array('ACTION_NAME' => 'activate', 'L_ACTION' => $this->user->lang['STYLE_ACTIVATE']));
$this->template->assign_block_vars('extra_actions', array('ACTION_NAME' => 'deactivate', 'L_ACTION' => $this->user->lang['STYLE_DEACTIVATE']));
if (isset($this->style_counters) && $this->style_counters['total'] > 1) {
$this->template->assign_block_vars('extra_actions', array('ACTION_NAME' => 'uninstall', 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL']));
}
}