当前位置: 首页>>代码示例>>PHP>>正文


PHP Template::assign_vars方法代码示例

本文整理汇总了PHP中Template::assign_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::assign_vars方法的具体用法?PHP Template::assign_vars怎么用?PHP Template::assign_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Template的用法示例。


在下文中一共展示了Template::assign_vars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 static function generate_select($auth_bit, $array_auth = array(), $array_ranks_default = array(), $idselect = '', $disabled = '', $disabled_advanced_auth = false)
 {
     global $Sql, $LANG, $CONFIG, $array_ranks, $Group;
     $array_ranks = is_array($array_ranks) ? $array_ranks : array('-1' => $LANG['guest'], '0' => $LANG['member'], '1' => $LANG['modo'], '2' => $LANG['admin']);
     $idselect = (string) $idselect == '' ? $auth_bit : $idselect;
     $Template = new Template('framework/groups_auth.tpl');
     $Template->assign_vars(array('C_NO_ADVANCED_AUTH' => $disabled_advanced_auth ? true : false, 'C_ADVANCED_AUTH' => $disabled_advanced_auth ? false : true, 'THEME' => get_utheme(), 'PATH_TO_ROOT' => TPL_PATH_TO_ROOT, 'IDSELECT' => $idselect, 'DISABLED_SELECT' => empty($disabled) ? 'if (disabled == 0)' : '', 'L_USERS' => $LANG['member_s'], 'L_ADD_USER' => $LANG['add_member'], 'L_REQUIRE_PSEUDO' => addslashes($LANG['require_pseudo']), 'L_RANKS' => $LANG['ranks'], 'L_GROUPS' => $LANG['groups'], 'L_GO' => $LANG['go'], 'L_ADVANCED_AUTHORIZATION' => $LANG['advanced_authorization'], 'L_SELECT_ALL' => $LANG['select_all'], 'L_SELECT_NONE' => $LANG['select_none'], 'L_EXPLAIN_SELECT_MULTIPLE' => $LANG['explain_select_multiple']));
     ##### Génération d'une liste à sélection multiple des rangs et membres #####
     //Liste des rangs
     $j = -1;
     foreach ($array_ranks as $idrank => $group_name) {
         //Si il s'agit de l'administrateur, il a automatiquement l'autorisation
         if ($idrank == 2) {
             $Template->assign_block_vars('ranks_list', array('ID' => $j, 'IDRANK' => $idrank, 'RANK_NAME' => $group_name, 'DISABLED' => '', 'SELECTED' => ' selected="selected"'));
         } else {
             $selected = '';
             if (array_key_exists('r' . $idrank, $array_auth) && ((int) $array_auth['r' . $idrank] & (int) $auth_bit) !== 0 && empty($disabled)) {
                 $selected = ' selected="selected"';
             }
             $selected = isset($array_ranks_default[$idrank]) && $array_ranks_default[$idrank] === true && empty($disabled) ? 'selected="selected"' : $selected;
             $Template->assign_block_vars('ranks_list', array('ID' => $j, 'IDRANK' => $idrank, 'RANK_NAME' => $group_name, 'DISABLED' => !empty($disabled) ? 'disabled = "disabled" ' : '', 'SELECTED' => $selected));
         }
         $j++;
     }
     foreach ($Group->get_groups_array() as $idgroup => $group_name) {
         $selected = '';
         if (array_key_exists($idgroup, $array_auth) && ((int) $array_auth[$idgroup] & (int) $auth_bit) !== 0 && empty($disabled)) {
             $selected = ' selected="selected"';
         }
         $Template->assign_block_vars('groups_list', array('IDGROUP' => $idgroup, 'GROUP_NAME' => $group_name, 'DISABLED' => $disabled, 'SELECTED' => $selected));
     }
     ##### Génération du formulaire pour les autorisations membre par membre. #####
     $array_auth_members = array();
     if (is_array($array_auth)) {
         foreach ($array_auth as $type => $auth) {
             if (substr($type, 0, 1) == 'm') {
                 if (array_key_exists($type, $array_auth) && ((int) $array_auth[$type] & (int) $auth_bit) !== 0) {
                     $array_auth_members[$type] = $auth;
                 }
             }
         }
     }
     $advanced_auth = count($array_auth_members) > 0;
     $Template->assign_vars(array('ADVANCED_AUTH_STYLE' => $advanced_auth ? 'display:block;' : 'display:none;'));
     if ($advanced_auth) {
         $result = $Sql->query_while("SELECT user_id, login\n\t\t\tFROM " . PREFIX . "member\n\t\t\tWHERE user_id IN(" . implode(str_replace('m', '', array_keys($array_auth_members)), ', ') . ")", __LINE__, __FILE__);
         while ($row = $Sql->fetch_assoc($result)) {
             $Template->assign_block_vars('members_list', array('USER_ID' => $row['user_id'], 'LOGIN' => $row['login']));
         }
         $Sql->query_close($result);
     }
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:53,代码来源:authorizations.class.php

示例2: lateral_menu

function lateral_menu()
{
    global $LANG, $CONFIG;
    $tpl = new Template('admin/menus/panel.tpl');
    $tpl->assign_vars(array('L_MENUS_MANAGEMENT' => $LANG['menus_management'], 'L_ADD_CONTENT_MENUS' => $LANG['menus_content_add'], 'L_ADD_LINKS_MENUS' => $LANG['menus_links_add'], 'L_ADD_FEED_MENUS' => $LANG['menus_feed_add'], 'L_MANAGE_THEME_COLUMNS' => $LANG['manage_theme_columns'], 'THEME_NAME' => get_utheme()));
    $tpl->parse();
}
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:7,代码来源:lateral_menu.php

示例3: displayError

 public function displayError()
 {
     if (!ini_get('display_errors')) {
         return;
     }
     $messages = explode("\n", $this->message);
     $messages = array_map('trim', $messages);
     $messages = array_filter($messages, 'strlen');
     $messages = array_values($messages);
     $param = array("code" => $this->code, "messages" => $messages, "file" => $this->file, "line" => $this->line, "trace" => debug_backtrace());
     $template = new Template();
     // set template
     $template->assign_vars($param);
     // load template
     if (!self::$template_filename) {
         self::$template_filename = dirname(__FILE__) . '/../../component/view/Exception.tpl';
     }
     if ($template->load(self::$template_filename)) {
         $html = $template->get_display_template(true);
     } else {
         throw new PMPException('Sysmtem Error ' . __CLASS__ . ' ' . __LINE__);
     }
     print $html;
     exit;
 }
开发者ID:ateliee,项目名称:pmp,代码行数:25,代码来源:PMPException.php

示例4: display

 function display()
 {
     global $CONFIG;
     static $js_inclusion_already_done = false;
     $template = new Template('framework/mini_calendar.tpl');
     $template->assign_vars(array('DEFAULT_DATE' => $this->date->format(DATE_FORMAT_SHORT), 'CALENDAR_ID' => 'calendar_' . $this->num_instance, 'CALENDAR_NUMBER' => (string) $this->num_instance, 'DAY' => $this->date->get_day(), 'MONTH' => $this->date->get_month(), 'YEAR' => $this->date->get_year(), 'FORM_NAME' => $this->form_name, 'CALENDAR_STYLE' => $this->style, 'C_INCLUDE_JS' => !$js_inclusion_already_done));
     $js_inclusion_already_done = true;
     return $template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:9,代码来源:mini_calendar.class.php

示例5: display

 function display()
 {
     $Template = new Template('framework/builder/forms/field_box.tpl');
     $Template->assign_vars(array('ID' => $this->field_id, 'FIELD' => $this->field_options, 'L_FIELD_TITLE' => $this->field_title, 'L_EXPLAIN' => $this->field_sub_title, 'L_REQUIRE' => $this->field_required ? '* ' : ''));
     foreach ($this->field_options as $Option) {
         $Option->field_name = $this->field_name;
         $Template->assign_block_vars('field_options', array('OPTION' => $Option->display()));
     }
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:10,代码来源:form_radio_choice.class.php

示例6: get_html_results

function get_html_results(&$results, &$html_results, &$results_name)
{
    global $CONFIG;
    $modules = new ModulesDiscoveryService();
    $display_all_results = $results_name == 'all' ? true : false;
    $tpl_results = new Template('search/search_generic_pagination_results.tpl');
    $tpl_results->assign_vars(array('RESULTS_NAME' => $results_name, 'C_ALL_RESULTS' => $display_all_results));
    $nb_pages = round(count($results) / NB_RESULTS_PER_PAGE) + 1;
    $nb_results = count($results);
    if (!$display_all_results) {
        $module = $modules->get_module(strtolower($results_name));
        $results_data = array();
        $personnal_parse_results = $module->has_functionality('compute_search_results') && $module->has_functionality('parse_search_result');
        if ($personnal_parse_results && $results_name != 'all') {
            $results_data = $module->functionality('compute_search_results', array('results' => $results));
            $nb_results = min($nb_results, count($results_data));
        }
    }
    for ($num_page = 0; $num_page < $nb_pages; $num_page++) {
        $tpl_results->assign_block_vars('page', array('NUM_PAGE' => $num_page, 'BLOCK_DISPLAY' => $num_page == 0 ? 'block' : 'none'));
        for ($i = 0; $i < NB_RESULTS_PER_PAGE; $i++) {
            $num_item = $num_page * NB_RESULTS_PER_PAGE + $i;
            if ($num_item >= $nb_results) {
                break;
            }
            if ($display_all_results || !$personnal_parse_results) {
                $tpl_result = new Template('search/search_generic_results.tpl');
                if ($display_all_results) {
                    $module = $modules->get_module($results[$num_item]['module']);
                    $tpl_result->assign_vars(array('C_ALL_RESULTS' => true, 'L_MODULE_NAME' => $module->get_name()));
                } else {
                    $tpl_result->assign_vars(array('C_ALL_RESULTS' => false, 'L_MODULE_NAME' => $module->get_name()));
                }
                $tpl_result->assign_vars(array('TITLE' => $results[$num_item]['title'], 'U_LINK' => url($results[$num_item]['link'])));
                $tpl_results->assign_block_vars('page.results', array('result' => $tpl_result->parse(TEMPLATE_STRING_MODE)));
            } else {
                $tpl_results->assign_block_vars('page.results', array('result' => $module->functionality('parse_search_result', $results_data[$num_item])));
            }
        }
    }
    $html_results = $tpl_results->parse(TEMPLATE_STRING_MODE);
}
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:42,代码来源:search.inc.php

示例7: Template

 function parse_search_result(&$result_data)
 {
     global $Cache, $CONFIG, $LANG, $DOWNLOAD_LANG, $CONFIG_DOWNLOAD;
     $Cache->load('download');
     load_module_lang('download');
     $tpl = new Template('download/download_generic_results.tpl');
     import('util/date');
     $date = new Date(DATE_TIMESTAMP, TIMEZONE_USER, $result_data['timestamp']);
     import('content/note');
     $tpl->assign_vars(array('L_ADDED_ON' => sprintf($DOWNLOAD_LANG['add_on_date'], $date->format(DATE_FORMAT_TINY, TIMEZONE_USER)), 'U_LINK' => url(PATH_TO_ROOT . '/download/download.php?id=' . $result_data['id']), 'U_IMG' => $result_data['image'], 'E_TITLE' => strprotect($result_data['title']), 'TITLE' => $result_data['title'], 'SHORT_DESCRIPTION' => second_parse($result_data['short_contents']), 'L_NB_DOWNLOADS' => $DOWNLOAD_LANG['downloaded'] . ' ' . sprintf($DOWNLOAD_LANG['n_times'], $result_data['count']), 'L_NB_COMMENTS' => $result_data['nbr_com'] > 1 ? sprintf($DOWNLOAD_LANG['num_com'], $result_data['nbr_com']) : sprintf($DOWNLOAD_LANG['num_coms'], $result_data['nbr_com']), 'L_MARK' => $result_data['note'] > 0 ? Note::display_img($result_data['note'], $CONFIG_DOWNLOAD['note_max'], 5) : '<em>' . $LANG['no_note'] . '</em>'));
     return $tpl->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:12,代码来源:download_interface.class.php

示例8: Template

 function display_form($Template = false)
 {
     global $CONFIG;
     $this->_save_user();
     if (!is_object($Template) || strtolower(get_class($Template)) != 'template') {
         $Template = new Template('framework/captcha.tpl');
     }
     if ($this->is_available()) {
         $Template->assign_vars(array('CAPTCHA_INSTANCE' => $this->instance, 'CAPTCHA_WIDTH' => $this->width, 'CAPTCHA_HEIGHT' => $this->height, 'CAPTCHA_FONT' => $this->font, 'CAPTCHA_DIFFICULTY' => $this->difficulty));
         return $Template->parse(TEMPLATE_STRING_MODE);
     }
     return '';
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:13,代码来源:captcha.class.php

示例9: display

    function display()
    {
        $Template = new Template('framework/builder/forms/field.tpl');
        $field = '<input type="file" ';
        $field .= !empty($this->field_size) ? 'size="' . $this->field_size . '" ' : '';
        $field .= !empty($this->field_name) ? 'name="' . $this->field_name . '" ' : '';
        $field .= !empty($this->field_id) ? 'id="' . $this->field_id . '" ' : '';
        $field .= !empty($this->field_css_class) ? 'class="' . $this->field_css_class . '" ' : '';
        $field .= '/>
		<input name="max_file_size" value="2000000" type="hidden">';
        $Template->assign_vars(array('ID' => $this->field_id, 'FIELD' => $field, 'L_FIELD_TITLE' => $this->field_title, 'L_EXPLAIN' => $this->field_sub_title, 'L_REQUIRE' => $this->field_required ? '* ' : ''));
        return $Template->parse(TEMPLATE_STRING_MODE);
    }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:13,代码来源:form_file_uploader.class.php

示例10: display

 function display()
 {
     $Template = new Template('framework/builder/forms/field_extended.tpl');
     $field = '<textarea type="text" ';
     $field .= !empty($this->field_rows) ? 'rows="' . $this->field_rows . '" ' : '';
     $field .= !empty($this->field_cols) ? 'cols="' . $this->field_cols . '" ' : '';
     $field .= !empty($this->field_name) ? 'name="' . $this->field_name . '" ' : '';
     $field .= !empty($this->field_id) ? 'id="' . $this->field_id . '" ' : '';
     $field .= !empty($this->field_css_class) ? 'class="' . $this->field_css_class . '"> ' : '>';
     $field .= !empty($this->field_value) ? $this->field_value : '';
     $field .= '</textarea>';
     $Template->assign_vars(array('ID' => $this->field_id, 'FIELD' => $field, 'KERNEL_EDITOR' => $this->field_editor ? display_editor($this->field_id, $this->field_forbidden_tags) : '', 'L_FIELD_TITLE' => $this->field_title, 'L_EXPLAIN' => $this->field_sub_title, 'L_REQUIRE' => $this->field_required ? '* ' : ''));
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:14,代码来源:form_textarea.class.php

示例11: display

 function display()
 {
     $Template = new Template('framework/builder/forms/field.tpl');
     $field = '<input type="text" ';
     $field .= !empty($this->field_size) ? 'size="' . $this->field_size . '" ' : '';
     $field .= !empty($this->field_maxlength) ? 'maxlength="' . $this->field_maxlength . '" ' : '';
     $field .= !empty($this->field_name) ? 'name="' . $this->field_name . '" ' : '';
     $field .= !empty($this->field_id) ? 'id="' . $this->field_id . '" ' : '';
     $field .= !empty($this->field_value) ? 'value="' . $this->field_value . '" ' : '';
     $field .= !empty($this->field_css_class) ? 'class="' . $this->field_css_class . '" ' : '';
     $field .= !empty($this->field_on_blur) ? 'onblur="' . $this->field_on_blur . '" ' : '';
     $field .= '/>';
     $Template->assign_vars(array('ID' => $this->field_id, 'FIELD' => $field, 'L_FIELD_TITLE' => $this->field_title, 'L_EXPLAIN' => $this->field_sub_title, 'L_REQUIRE' => $this->field_required ? '* ' : ''));
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:15,代码来源:form_text_edit.class.php

示例12: display

 function display()
 {
     $Template = new Template('framework/builder/forms/field_select.tpl');
     if ($this->field_multiple) {
         $field = '<select name="' . $this->field_name . '[]" multiple="multiple">' . $this->field_options . '</select>';
     } else {
         $field = '<select name="' . $this->field_name . '">' . $this->field_options . '</select>';
     }
     $Template->assign_vars(array('ID' => $this->field_id, 'C_SELECT_MULTIPLE' => $this->field_multiple, 'L_FIELD_NAME' => $this->field_name, 'L_FIELD_TITLE' => $this->field_title, 'L_EXPLAIN' => $this->field_sub_title, 'L_REQUIRE' => $this->field_required ? '* ' : ''));
     foreach ($this->field_options as $Option) {
         $Option->field_name = $this->field_name;
         $Template->assign_block_vars('field_options', array('OPTION' => $Option->display()));
     }
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:15,代码来源:form_select.class.php

示例13: display

 function display($Template = false)
 {
     global $LANG, $Errorh;
     if (!is_object($Template) || strtolower(get_class($Template)) != 'template') {
         $Template = new Template('framework/builder/forms/fieldset.tpl');
     }
     $Template->assign_vars(array('C_DISPLAY_WARNING_REQUIRED_FIELDS' => $this->fieldset_display_required, 'L_FORMTITLE' => $this->fieldset_title, 'L_REQUIRED_FIELDS' => $LANG['require']));
     foreach ($this->fieldset_errors as $error) {
         $Template->assign_block_vars('errors', array('ERROR' => $Errorh->display($error['errstr'], $error['errno'])));
     }
     foreach ($this->fieldset_fields as $Field) {
         foreach ($Field->get_errors() as $error) {
             $Template->assign_block_vars('errors', array('ERROR' => $Errorh->display($error['errstr'], $error['errno'])));
         }
         $Template->assign_block_vars('fields', array('FIELD' => $Field->display()));
     }
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:18,代码来源:form_fieldset.class.php

示例14: display

 function display($Template = false)
 {
     global $LANG;
     if (!is_object($Template) || strtolower(get_class($Template)) != 'template') {
         $Template = new Template('framework/builder/forms/form.tpl');
     }
     $Template->assign_vars(array('C_DISPLAY_PREVIEW' => $this->display_preview, 'C_DISPLAY_RESET' => $this->display_reset, 'FORMCLASS' => $this->form_class, 'U_FORMACTION' => $this->form_action, 'L_FORMNAME' => $this->form_name, 'L_FIELD_CONTENT_PREVIEW' => $this->field_identifier_preview, 'L_SUBMIT' => $this->form_submit, 'L_PREVIEW' => $LANG['preview'], 'L_RESET' => $LANG['reset']));
     foreach ($this->form_fieldsets as $Fieldset) {
         foreach ($Fieldset->get_fields() as $Field) {
             $field_required_alert = $Field->get_required_alert();
             if (!empty($field_required_alert)) {
                 $Template->assign_block_vars('check_form', array('FIELD_ID' => $Field->get_id(), 'FIELD_REQUIRED_ALERT' => str_replace('"', '\\"', $field_required_alert)));
             }
         }
         $Template->assign_block_vars('fieldsets', array('FIELDSET' => $Fieldset->display()));
     }
     return $Template->parse(TEMPLATE_STRING_MODE);
 }
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:18,代码来源:form_builder.class.php

示例15: retrieve

<?php

require_once '../kernel/begin.php';
load_module_lang('wiki');
include '../wiki/wiki_functions.php';
$article_id = retrieve(GET, 'id', 0);
if ($article_id > 0) {
    $result = $Sql->query_while("SELECT a.id, a.is_cat, a.hits, a.redirect, a.id_cat, a.title, a.encoded_title, a.is_cat, a.defined_status, a.nbr_com, f.id AS id_favorite, a.undefined_status, a.auth, c.menu, c.content\n\tFROM " . PREFIX . "wiki_articles a\n\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\tLEFT JOIN " . PREFIX . "wiki_favorites f ON f.id_article = a.id\n\tWHERE a.id = '" . $article_id . "'\n\tGROUP BY a.id", __LINE__, __FILE__);
    $num_rows = $Sql->num_rows($result, "SELECT COUNT(*) FROM " . PREFIX . "wiki_articles WHERE id = '" . $article_id . "'", __LINE__, __FILE__);
    $article_infos = $Sql->fetch_assoc($result);
    $Sql->query_close($result);
    if (!empty($article_infos['redirect'])) {
        $id_redirection = $article_infos['id'];
        $result = $Sql->query_while("SELECT a.id, a.is_cat, a.hits, a.redirect, a.id_cat, a.title, a.encoded_title, a.is_cat, a.nbr_com, a.defined_status, f.id AS id_favorite, a.undefined_status, a.auth, c.menu, c.content\n\t\tFROM " . PREFIX . "wiki_articles a\n\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\t\tLEFT JOIN " . PREFIX . "wiki_favorites f ON f.id_article = a.id\n\t\tWHERE a.id = '" . $article_infos['redirect'] . "'\n\t\tGROUP BY a.id", __LINE__, __FILE__);
        $article_infos = $Sql->fetch_assoc($result);
        $Sql->query_close($result);
    }
}
if (empty($article_infos['id'])) {
    exit;
}
require_once PATH_TO_ROOT . '/kernel/header_no_display.php';
$template = new Template('framework/content/print.tpl');
$template->assign_vars(array('PAGE_TITLE' => $article_infos['title'] . (!empty($_WIKI_CONFIG['wiki_name']) ? $_WIKI_CONFIG['wiki_name'] : $LANG['wiki']), 'TITLE' => $article_infos['title'], 'L_XML_LANGUAGE' => $LANG['xml_lang'], 'CONTENT' => second_parse($article_infos['content'])));
$template->parse();
require_once PATH_TO_ROOT . '/kernel/footer_no_display.php';
开发者ID:janus57,项目名称:PHPBoost_v3c,代码行数:26,代码来源:print.php


注:本文中的Template::assign_vars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。