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


PHP FileTemplate::assign_vars方法代码示例

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


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

示例1: get_html_results

/**
 *  Renvoie une chaine contenant les resultats
 */
function get_html_results(&$results, &$html_results, &$results_name)
{
    $provider_service = AppContext::get_extension_provider_service();
    $display_all_results = $results_name == 'all' ? true : false;
    $tpl_results = new FileTemplate('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) {
        $provider = $provider_service->get_provider(strtolower($results_name));
        $extension_point = $provider->get_extension_point(SearchableExtensionPoint::EXTENSION_POINT);
        $results_data = array();
        $personnal_parse_results = $extension_point->has_customized_results();
        if ($personnal_parse_results && $results_name != 'all') {
            $results_data = $extension_point->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 FileTemplate('search/search_generic_results.tpl');
                $module = ModulesManager::get_module($results[$num_item]['module']);
                if ($display_all_results) {
                    $tpl_result->assign_vars(array('C_ALL_RESULTS' => true, 'L_MODULE_NAME' => $module->get_configuration()->get_name()));
                } else {
                    $tpl_result->assign_vars(array('C_ALL_RESULTS' => false, 'L_MODULE_NAME' => $module->get_configuration()->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->render()));
            } else {
                $tpl_results->assign_block_vars('page.results', array('result' => $extension_point->parse_search_result($results_data[$num_item])));
            }
        }
    }
    $html_results = $tpl_results->render();
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:45,代码来源:search.inc.php

示例2: array

    if ($search_in != 'all') {
        if (isset($used_modules[$search_in]) && isset($modules_args[$search_in])) {
            $used_modules = array($search_in => $used_modules[$search_in]);
            $modules_args = array($search_in => $modules_args[$search_in]);
        } else {
            $used_modules = array();
            $modules_args = array();
        }
    } else {
        // We remove modules that we're not searching in
        foreach ($modules_args as $module_id => $module_args) {
            if (!$query_mode && (!in_array($module_id, $selected_modules) || !isset($modules_args[$module_id]))) {
                unset($modules_args[$module_id]);
                unset($used_modules[$module_id]);
            }
        }
    }
    // Génération des résultats et passage aux templates
    $nbResults = get_search_results($search, $used_modules, $modules_args, $results, $idsSearch);
    foreach ($used_modules as $module_id => $extension_point) {
        $tpl->assign_block_vars('results', array('MODULE_NAME' => $module_id, 'L_MODULE_NAME' => ucfirst(ModulesManager::get_module($module_id)->get_configuration()->get_name()), 'ID_SEARCH' => $idsSearch[$module_id]));
    }
    $all_html_result = '';
    if ($nbResults > 0) {
        get_html_results($results, $all_html_result, $search_in);
    }
    $tpl->assign_vars(array('NB_RESULTS_PER_PAGE' => NB_RESULTS_PER_PAGE, 'L_TITLE_ALL_RESULTS' => $LANG['title_all_results'], 'L_RESULTS' => $LANG['results'], 'L_RESULTS_CHOICE' => $LANG['results_choice'], 'L_PRINT' => $LANG['print'], 'L_NB_RESULTS_FOUND' => $nbResults > 1 ? $LANG['nb_results_found'] : ($nbResults == 0 ? $LANG['no_results_found'] : $LANG['one_result_found']), 'L_SEARCH_RESULTS' => $LANG['search_results'], 'NB_RESULTS' => $nbResults, 'ALL_RESULTS' => $all_html_result, 'SEARCH_IN' => $search_in, 'C_SIMPLE_SEARCH' => $search_in == 'all'));
    $tpl->display();
}
//--------------------------------------------------------------------- Footer
require_once '../kernel/footer.php';
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:search.php

示例3: foreach

        foreach ($provider_service->get_providers(SearchableExtensionPoint::EXTENSION_POINT) as $module_id => $provider) {
            $search_weightings->add_module_weighting($module_id, retrieve(POST, $module_id, SearchWeightings::DEFAULT_WEIGHTING));
        }
        SearchConfig::load()->set_weightings($search_weightings);
        SearchConfig::save();
        AppContext::get_response()->redirect(HOST . REWRITED_SCRIPT);
    }
} elseif ($clearOutCache) {
    $querier = PersistenceContext::get_querier();
    $querier->truncate(PREFIX . 'search_results');
    $querier->truncate(PREFIX . 'search_index');
    AppContext::get_response()->redirect(HOST . SCRIPT);
} else {
    $tpl = new FileTemplate('search/admin_search.tpl');
    $config = SearchConfig::load();
    $tpl->assign_vars(array('L_SEARCH_MANAGEMENT' => $LANG['search_management'], 'L_SEARCH_CONFIG' => $LANG['search_config'], 'L_SEARCH_CONFIG_WEIGHTING' => $LANG['search_config_weighting'], 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'C_WEIGHTING' => $weighting));
    if (!$weighting) {
        $provider_service = AppContext::get_extension_provider_service();
        foreach ($provider_service->get_providers(SearchableExtensionPoint::EXTENSION_POINT) as $module_id => $provider) {
            $module_configuration = ModulesManager::get_module($module_id)->get_configuration();
            if (in_array($module_id, $config->get_unauthorized_providers())) {
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $tpl->assign_block_vars('authorized_modules', array('MODULE' => $module_id, 'SELECTED' => $selected, 'L_MODULE_NAME' => ucfirst($module_configuration->get_name())));
        }
        $tpl->put_all(array('L_REQUIRE' => LangLoader::get_message('form.explain_required_fields', 'status-messages-common'), 'L_CACHE_TIME' => $LANG['cache_time'], 'L_CACHE_TIME_EXPLAIN' => $LANG['cache_time_explain'], 'L_NB_RESULTS_P' => $LANG['nb_results_per_page'], 'L_MAX_USE' => $LANG['max_use'], 'L_MAX_USE_EXPLAIN' => $LANG['max_use_explain'], 'L_CLEAR_OUT_CACHE' => $LANG['clear_out_cache'], 'L_AUTHORIZED_MODULES' => $LANG['unauthorized_modules'], 'L_AUTHORIZED_MODULES_EXPLAIN' => $LANG['unauthorized_modules_explain'], 'L_SEARCH_CACHE' => $LANG['search_cache'], 'L_AUTHORIZATIONS' => $LANG['admin.authorizations'], 'L_READ_AUTHORIZATION' => $LANG['admin.authorizations.read'], 'CACHE_TIME' => $config->get_cache_lifetime(), 'MAX_USE' => $config->get_cache_max_uses(), 'NB_RESULTS_P' => $config->get_nb_results_per_page(), 'READ_AUTHORIZATION' => Authorizations::generate_select(SearchAuthorizationsService::READ_AUTHORIZATIONS, $config->get_authorizations())));
    } else {
        foreach ($config->get_weightings()->get_modules_weighting() as $module_id => $weighting) {
            $tpl->assign_block_vars('weights', array('MODULE' => $module_id, 'L_MODULE_NAME' => ucfirst(ModulesManager::get_module($module_id)->get_configuration()->get_name()), 'WEIGHT' => $weighting));
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:admin_search.php


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