本文整理汇总了PHP中Template::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::put方法的具体用法?PHP Template::put怎么用?PHP Template::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assign_template
private function assign_template(Template $tpl)
{
$tpl->put('CONTENT', 'fruits:');
foreach ($this->fruits as $fruit) {
$tpl->assign_block_vars('elements', array('NAME' => $fruit));
}
}
示例2: generate_pagination
private function generate_pagination()
{
$nb_pages = $this->get_nb_pages();
$pagination = new Pagination($nb_pages, $this->page_number);
$pagination->set_url_builder_callback(array($this->parameters, 'get_pagination_url'));
$this->tpl->put('pagination', $pagination->export());
}
示例3: add_filter_fieldset
public static function add_filter_fieldset(Menu $menu, Template $tpl)
{
$tpl_filter = new FileTemplate('admin/menus/filters.tpl');
$tpl_filter->assign_block_vars('modules', array('ID' => ''));
foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) {
$configuration = $module->get_configuration();
$home_page = $configuration->get_home_page();
if (!empty($home_page)) {
$tpl_filter->assign_block_vars('modules', array('ID' => $module->get_id()));
}
}
//Ajout du menu
if ($menu->get_id() == '') {
$menu->set_filters(array(new MenuStringFilter('/')));
}
// Installed modules
foreach ($menu->get_filters() as $key => $filter) {
$filter_pattern = $filter->get_pattern();
$filter_infos = explode('/', $filter_pattern);
$module_name = $filter_infos[0];
$regex = substr(strstr($filter_pattern, '/'), 1);
$tpl_filter->assign_block_vars('filters', array('ID' => $key, 'FILTER' => $regex));
$tpl_filter->assign_block_vars('filters.modules', array('ID' => '', 'SELECTED' => $filter_pattern == '/' ? ' selected="selected"' : ''));
foreach (ModulesManager::get_activated_modules_map_sorted_by_localized_name() as $module) {
$configuration = $module->get_configuration();
$home_page = $configuration->get_home_page();
if (!empty($home_page)) {
$tpl_filter->assign_block_vars('filters.modules', array('ID' => $module->get_id(), 'SELECTED' => $module_name == $module->get_id() ? ' selected="selected"' : ''));
}
}
}
$tpl_filter->add_lang(LangLoader::get('admin-menus-common'));
$tpl_filter->put_all(array('NBR_FILTER' => $menu->get_id() == '' ? 0 : count($menu->get_filters()) - 1));
$tpl->put('filters', $tpl_filter);
}
示例4: add_language_bar
private function add_language_bar()
{
$lang = AppContext::get_request()->get_string('lang', self::UPDATE_DEFAULT_LANGUAGE);
$lang_dir = new Folder(PATH_TO_ROOT . '/lang');
$langs = array();
foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
$info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
if (!empty($info_lang['name'])) {
$langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
if ($folder->get_name() == $lang) {
$this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
}
}
}
$this->full_view->put('lang', $langs);
}
示例5: create_response
/**
* @param Template $view
* @return InstallDisplayResponse
*/
private function create_response()
{
$this->view = new FileTemplate('install/website.tpl');
$this->view->put('WEBSITE_FORM', $this->form->display());
$step_title = $this->lang['step.websiteConfig.title'];
$response = new InstallDisplayResponse(4, $step_title, $this->view);
return $response;
}
示例6: check_folders_permissions
private function check_folders_permissions()
{
$folders = array();
foreach (PHPBoostFoldersPermissions::get_permissions() as $folder_name => $folder) {
$folders[] = array('NAME' => $folder_name, 'EXISTS' => $folder->exists(), 'IS_WRITABLE' => $folder->is_writable());
}
$this->view->put('folder', $folders);
}
示例7: create_response
/**
* @return InstallDisplayResponse
*/
private function create_response()
{
$this->view = new FileTemplate('install/admin.tpl');
$this->view->put('ADMIN_FORM', $this->form->display());
$step_title = $this->lang['step.admin.title'];
$response = new InstallDisplayResponse(5, $step_title, $this->view);
return $response;
}
示例8: add_language_bar
private function add_language_bar()
{
$lang = TextHelper::htmlspecialchars(AppContext::get_request()->get_string('lang', InstallController::DEFAULT_LOCALE));
$lang = in_array($lang, InstallationServices::get_available_langs()) ? $lang : InstallController::DEFAULT_LOCALE;
$lang_dir = new Folder(PATH_TO_ROOT . '/lang');
$langs = array();
foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
$info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
if (!empty($info_lang['name'])) {
$langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
if ($folder->get_name() == $lang) {
$this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
}
}
}
$this->full_view->put('lang', $langs);
}
示例9: add_navigation
private function add_navigation(Template $view)
{
$form = new HTMLForm('preambleForm', InstallUrlBuilder::license()->rel(), false);
$action_fieldset = new FormFieldsetSubmit('actions');
$next = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'welcome');
$action_fieldset->add_element($next);
$form->add_fieldset($action_fieldset);
$view->put('LICENSE_FORM', $form->display());
}
示例10: add_navigation
private function add_navigation(Template $view)
{
$form = new HTMLForm('continueForm', '#error', false);
$action_fieldset = new FormFieldsetSubmit('actions');
$back = new FormButtonLinkCssImg($this->lang['step.previous'], UpdateServices::database_config_file_checked() ? UpdateUrlBuilder::server_configuration() : UpdateUrlBuilder::database(), 'fa fa-arrow-left');
$action_fieldset->add_element($back);
$this->submit = new FormButtonSubmitCssImg($this->lang['step.next'], 'fa fa-arrow-right', 'finish');
$action_fieldset->add_element($this->submit);
$form->add_fieldset($action_fieldset);
$view->put('SERVER_FORM', $form->display());
}
示例11: create_response
/**
* @return InstallDisplayResponse
*/
private function create_response()
{
$this->view = new FileTemplate('install/database.tpl');
$this->view->put('DATABASE_FORM', $this->form->display());
if (!empty($this->error)) {
$this->view->put('ERROR', $this->error);
}
$step_title = $this->lang['step.dbConfig.title'];
$response = new InstallDisplayResponse(3, $step_title, $this->view);
return $response;
}
示例12: display_menus
protected function display_menus(Template $template)
{
$menus = MenusCache::load()->get_menus();
$columns_disabled = ThemesManager::get_theme(AppContext::get_current_user()->get_theme())->get_columns_disabled();
foreach ($menus as $cached_menu) {
$menu = $cached_menu->get_menu();
if ($menu->check_auth() && !$columns_disabled->menus_column_is_disabled($menu->get_block())) {
$display = false;
$filters = $menu->get_filters();
$nbr_filters = count($filters);
foreach ($filters as $filter) {
if ($nbr_filters > 1 && $filter->get_pattern() != '/' || $filter->match() && !$display) {
$display = true;
}
}
if ($display) {
$menu_content = $cached_menu->has_cached_string() ? $cached_menu->get_cached_string() : $menu->display();
$block = $menu->get_block();
switch ($block) {
case Menu::BLOCK_POSITION__HEADER:
$template->put('C_MENUS_HEADER_CONTENT', true);
$template->assign_block_vars('menus_header', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__SUB_HEADER:
$template->put('C_MENUS_SUB_HEADER_CONTENT', true);
$template->assign_block_vars('menus_sub_header', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__LEFT:
$template->put('C_MENUS_LEFT_CONTENT', true);
$template->assign_block_vars('menus_left', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__RIGHT:
$template->put('C_MENUS_RIGHT_CONTENT', true);
$template->assign_block_vars('menus_right', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__TOP_CENTRAL:
$template->put('C_MENUS_TOPCENTRAL_CONTENT', true);
$template->assign_block_vars('menus_top_central', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__BOTTOM_CENTRAL:
$template->put('C_MENUS_BOTTOM_CENTRAL_CONTENT', true);
$template->assign_block_vars('menus_bottom_central', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__TOP_FOOTER:
$template->put('C_MENUS_TOP_FOOTER_CONTENT', true);
$template->assign_block_vars('menus_top_footer', array('MENU' => $menu_content));
break;
case Menu::BLOCK_POSITION__FOOTER:
$template->put('C_MENUS_FOOTER_CONTENT', true);
$template->assign_block_vars('menus_footer', array('MENU' => $menu_content));
}
}
}
}
}
示例13: assign_common_template_variables
protected function assign_common_template_variables(Template $template)
{
$has_js_validations = false;
$js_tpl = new FileTemplate('framework/builder/form/AddFieldJS.tpl');
foreach ($this->get_related_fields() as $field) {
$js_tpl->assign_block_vars('related_field', array('ID' => $field));
$has_js_validations = true;
}
foreach ($this->events as $event => $handler) {
$js_tpl->assign_block_vars('event_handler', array('EVENT' => $event, 'HANDLER' => $handler));
$has_js_validations = true;
}
foreach ($this->get_js_validations() as $constraint) {
$js_tpl->assign_block_vars('constraint', array('CONSTRAINT' => $constraint));
$has_js_validations = true;
}
$js_tpl->put_all(array('C_DISABLED' => $this->is_disabled(), 'C_HAS_CONSTRAINTS' => $this->has_constraints(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'JS_SPECIALIZATION_CODE' => $this->get_js_specialization_code(), 'FORM_ID' => $this->form_id, 'FIELDSET_ID' => $this->fieldset_id));
$template->put('ADD_FIELD_JS', $js_tpl);
$description = $this->get_description();
$template->put_all(array('ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'NAME' => $this->get_html_id(), 'LABEL' => $this->get_label(), 'DESCRIPTION' => $description, 'C_DESCRIPTION' => !empty($description), 'C_REQUIRED' => $this->is_required(), 'C_REQUIRED_AND_HAS_VALUE' => $this->is_required() && (!empty($this->value) || $this->value == '0'), 'VALUE' => $this->get_value(), 'C_HAS_CONSTRAINTS' => $this->has_constraints(), 'CLASS' => $this->get_css_class(), 'FIELD_CLASS' => $this->get_css_field_class(), 'C_HAS_FIELD_CLASS' => $this->get_css_field_class() != '', 'FORM_FIELD_CLASS' => $this->get_css_form_field_class(), 'C_HAS_FORM_FIELD_CLASS' => $this->get_css_form_field_class() != '', 'FORM_ID' => $this->form_id, 'FIELDSET_ID' => $this->fieldset_id, 'C_HAS_LABEL' => !empty($description) || $this->get_label() != '', 'C_DISABLED' => $this->is_disabled(), 'C_READONLY' => $this->is_readonly(), 'C_HIDDEN' => $this->is_hidden(), 'C_PATTERN' => $this->has_pattern(), 'PATTERN' => $this->pattern, 'C_PLACEHOLDER' => $this->has_placeholder(), 'PLACEHOLDER' => $this->placeholder));
}
示例14: send
public function send()
{
$this->full_view->put('links', $this->links);
parent::send();
}
示例15: assign
private function assign(Template $tpl)
{
$tpl->put('TARGET', $this->target);
$tpl->put('METHOD', $this->method);
$events = array();
foreach ($this->events as $event => $callback) {
$events[] = array('NAME' => $event, 'CALLBACK' => $callback);
}
$tpl->put('event', $events);
$params = array();
foreach ($this->parameters as $key => $value) {
$params[] = array('NAME' => $key, 'VALUE' => $value);
}
$tpl->put('param', $params);
}