本文整理汇总了PHP中FileTemplate类的典型用法代码示例。如果您正苦于以下问题:PHP FileTemplate类的具体用法?PHP FileTemplate怎么用?PHP FileTemplate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileTemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_subheader_tpl
private static function get_subheader_tpl()
{
$subheader_lang = LangLoader::get('admin-links-common');
$subheader_tpl = new FileTemplate('admin/subheader_menu.tpl');
$subheader_tpl->add_lang($subheader_lang);
$modules = ModulesManager::get_activated_modules_map_sorted_by_localized_name();
$modules_number = 0;
foreach ($modules as $module) {
if ($module->get_configuration()->get_admin_menu() == 'modules') {
$modules_number++;
}
}
$subheader_tpl->put_all(array('L_ADD' => $subheader_lang['add'], 'L_ADMINISTRATION' => $subheader_lang['administration'], 'L_MANAGEMENT' => $subheader_lang['management'], 'L_CONFIGURATION' => $subheader_lang['configuration'], 'L_CONFIG_GENERAL' => $subheader_lang['administration.configuration.general'], 'L_CONFIG_ADVANCED' => $subheader_lang['administration.configuration.advanced'], 'L_MAIL_CONFIG' => $subheader_lang['administration.configuration.mail'], 'L_THEMES' => $subheader_lang['administration.themes'], 'L_LANGS' => $subheader_lang['administration.langs'], 'L_SMILEY' => $subheader_lang['administration.smileys'], 'L_ADMINISTRATOR_ALERTS' => $subheader_lang['administration.alerts'], 'L_TOOLS' => $subheader_lang['tools'], 'L_UPDATES' => $subheader_lang['updates'], 'L_KERNEL' => $subheader_lang['tools.updates.kernel'], 'L_MAINTAIN' => $subheader_lang['tools.maintain'], 'L_CACHE' => $subheader_lang['tools.cache'], 'L_SYNDICATION_CACHE' => $subheader_lang['tools.cache.syndication'], 'L_CSS_CACHE_CONFIG' => $subheader_lang['tools.cache.css'], 'L_ERRORS' => $subheader_lang['tools.errors-archived'], 'L_404_ERRORS' => $subheader_lang['tools.404-errors-archived'], 'L_SERVER' => $subheader_lang['tools.server'], 'L_PHPINFO' => $subheader_lang['tools.server.phpinfo'], 'L_SYSTEM_REPORT' => $subheader_lang['tools.server.system-report'], 'L_USER' => $subheader_lang['users'], 'L_PUNISHEMENT' => $subheader_lang['users.punishement'], 'L_GROUP' => $subheader_lang['users.groups'], 'L_EXTEND_FIELD' => $subheader_lang['users.extended-fields'], 'L_CONTENT' => $subheader_lang['content'], 'L_CONTENT_CONFIG' => $subheader_lang['content'], 'L_MENUS' => $subheader_lang['content.menus'], 'L_ADD_CONTENT_MENU' => $subheader_lang['content.menus.content'], 'L_ADD_LINKS_MENU' => $subheader_lang['content.menus.links'], 'L_ADD_FEED_MENU' => $subheader_lang['content.menus.feed'], 'L_FILES' => $subheader_lang['content.files'], 'L_COMMENTS' => $subheader_lang['content.comments'], 'L_MODULES' => $subheader_lang['modules'], 'U_NBR_MODULES' => ceil(($modules_number + 1) / 7), 'U_INDEX_SITE' => Environment::get_home_page(), 'C_ADMIN_LINKS_1' => false, 'C_ADMIN_LINKS_2' => false, 'C_ADMIN_LINKS_3' => false, 'C_ADMIN_LINKS_4' => false, 'C_ADMIN_LINKS_5' => false, 'C_ADMIN_LINKS_1' => false));
$array_pos = array(0, 4, 4, 3, 3, 1);
$menus_numbers = array('index' => 1, 'administration' => 2, 'tools' => 3, 'members' => 4, 'content' => 5, 'modules' => 6);
foreach ($modules as $module) {
$module_id = $module->get_id();
$configuration = $module->get_configuration();
$menu_pos_name = $configuration->get_admin_menu();
$menu_pos = 0;
if (!empty($menu_pos_name) && !empty($menus_numbers[$menu_pos_name])) {
$menu_pos = $menus_numbers[$menu_pos_name];
}
if ($menu_pos > 0) {
$array_pos[$menu_pos - 1]++;
$idmenu = $array_pos[$menu_pos - 1];
$subheader_tpl->put('C_ADMIN_LINKS_' . $menu_pos, true);
$subheader_tpl->assign_block_vars('admin_links_' . $menu_pos, array('MODULE_MENU' => ModuleTreeLinksService::display_admin_actions_menu($module)));
}
}
return $subheader_tpl;
}
示例2: display
public static function display($content, $type, $timeout = 0, $display_small = false)
{
$tpl = new FileTemplate('framework/helper/message.tpl');
switch ($type) {
case self::SUCCESS:
$css_class = 'success';
$image = 'error_success';
break;
case self::NOTICE:
$css_class = 'notice';
$image = 'error_notice';
break;
case self::WARNING:
$css_class = 'warning';
$image = 'error_warning';
break;
case self::ERROR:
$css_class = 'error';
$image = 'error_fatal';
break;
case self::QUESTION:
$css_class = 'question';
$image = 'error_question';
break;
}
$tpl->put_all(array('ID' => KeyGenerator::generate_key(4), 'MESSAGE_CSS_CLASS' => $css_class . ($display_small ? ' message-helper-small' : ''), 'MESSAGE_IMG' => $image, 'MESSAGE_CONTENT' => $content, 'C_TIMEOUT' => $timeout > 0, 'TIMEOUT' => $timeout * 1000));
return $tpl;
}
示例3: lateral_menu
function lateral_menu()
{
global $LANG;
$tpl = new FileTemplate('admin/menus/panel.tpl');
$tpl->put_all(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']));
$tpl->display();
}
示例4: display
public function display($content)
{
$template = new FileTemplate('admin/frame.tpl');
$customization_config = CustomizationConfig::load();
$template->put_all(array('C_FAVICON' => $customization_config->favicon_exists(), 'C_CSS_CACHE_ENABLED' => CSSCacheConfig::load()->is_enabled(), 'FAVICON' => Url::to_rel($customization_config->get_favicon_path()), 'FAVICON_TYPE' => $customization_config->favicon_type(), 'TITLE' => $this->get_seo_meta_data()->get_full_title(), 'MODULES_CSS' => $this->get_modules_css_files_html_code(), 'JS_TOP' => new FileTemplate('js_top.tpl'), 'JS_BOTTOM' => new FileTemplate('js_bottom.tpl'), 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'BODY' => new StringTemplate($content)));
$template->display();
}
示例5: get_content
public function get_content()
{
$tpl = new FileTemplate('newsletter/newsletter_mini.tpl');
$tpl->add_lang(LangLoader::get('common', 'newsletter'));
$tpl->put('USER_MAIL', AppContext::get_current_user()->get_email());
return $tpl;
}
示例6: processTemplateMacro
function processTemplateMacro($macro, $file, $optstr)
{
$template = new FileTemplate($file);
$template->registerFilter(Environment::getNette()->createLatte());
$template->registerHelperLoader('TemplateHelpers::loader');
$template->setCacheStorage(Environment::getContext()->nette->templateCacheStorage);
$template->page = $this->pageContext;
//TODO disable macros in getContent()
$template->opts = $opts = self::parseOptions($optstr);
//from Nette\Application\UI\Control
$template->baseUri = $template->baseUrl = rtrim($this->url->getBaseUrl(), '/');
$template->basePath = preg_replace('#https?://[^/]+#A', '', $template->baseUrl);
//lang settings
$template->lang = $this->pageContext->lang;
$template->langs = $this->i18n->langs;
$template->setTranslator(new TranslationsModel($this->pageContext->lang));
try {
$template = $template->__toString(true);
} catch (Exception $e) {
if (Debugger::$productionMode) {
Debugger::log($e);
return "<span class='zprava'>Error: {$macro} not availible</span>";
} else {
return "<span class='zprava'>Error: " . $e->getMessage() . "</span>";
}
}
return $template;
}
示例7: get_menu_content
public function get_menu_content()
{
$tpl = new FileTemplate('calendar/CalendarModuleMiniMenu.tpl');
$tpl->add_lang(LangLoader::get('common', 'calendar'));
$tpl->put('CALENDAR', CalendarAjaxCalendarController::get_view(true));
return $tpl->render();
}
示例8: create_response
/**
* @param Template $view
* @return InstallDisplayResponse
*/
private function create_response()
{
$view = new FileTemplate('install/license.tpl');
$view->put('LICENSE_FORM', $this->form->display());
$step_title = $this->lang['step.license.title'];
$response = new InstallDisplayResponse(1, $step_title, $view);
return $response;
}
示例9: display
public function display()
{
$tpl = new FileTemplate('ReCaptcha/ReCaptcha.tpl');
$this->lang = LangLoader::get('common', 'ReCaptcha');
$tpl->add_lang($this->lang);
$tpl->put_all(array('C_RECAPTCHA_V2' => $this->is_recaptcha_v2, 'SITE_KEY' => $this->is_recaptcha_v2 ? $this->config->get_site_key() : self::DEFAULT_SITE_KEY, 'HTML_ID' => $this->get_html_id()));
return $tpl->render();
}
示例10: get_content
public function get_content()
{
global $LANG;
load_module_lang('search');
$search = retrieve(REQUEST, 'q', '');
$tpl = new FileTemplate('search/search_mini.tpl');
$tpl->put_all(array('TEXT_SEARCHED' => !empty($search) ? stripslashes(retrieve(REQUEST, 'q', '')) : '', 'WARNING_LENGTH_STRING_SEARCH' => addslashes($LANG['warning_length_string_searched']), 'L_SEARCH' => $LANG['search'], 'U_FORM_VALID' => url(TPL_PATH_TO_ROOT . '/search/search.php#results'), 'L_ADVANCED_SEARCH' => $LANG['advanced_search'], 'U_ADVANCED_SEARCH' => url(TPL_PATH_TO_ROOT . '/search/search.php')));
return $tpl;
}
示例11: display
/**
* {@inheritdoc}
*/
public function display($content)
{
$template = new FileTemplate('frame.tpl');
$customization_config = CustomizationConfig::load();
$lang = LangLoader::get('main');
$description = $this->get_seo_meta_data()->get_full_description();
$template->put_all(array('C_CSS_CACHE_ENABLED' => CSSCacheConfig::load()->is_enabled(), 'C_CSS_LOGIN_DISPLAYED' => $this->display_css_login, 'C_FAVICON' => $customization_config->favicon_exists(), 'C_CANONICAL_URL' => $this->get_seo_meta_data()->canonical_link_exists(), 'C_DESCRIPTION' => !empty($description), 'FAVICON' => Url::to_rel($customization_config->get_favicon_path()), 'FAVICON_TYPE' => $customization_config->favicon_type(), 'TITLE' => $this->get_seo_meta_data()->get_full_title(), 'SITE_DESCRIPTION' => $description, 'U_CANONICAL' => $this->get_seo_meta_data()->get_canonical_link(), 'L_XML_LANGUAGE' => LangLoader::get_message('xml_lang', 'main'), 'PHPBOOST_VERSION' => GeneralConfig::load()->get_phpboost_major_version(), 'MODULES_CSS' => $this->get_modules_css_files_html_code(), 'JS_TOP' => new FileTemplate('js_top.tpl'), 'JS_BOTTOM' => new FileTemplate('js_bottom.tpl'), 'BODY' => new StringTemplate($content)));
$template->display(true);
}
示例12: display
/**
* @return Template The html code for the file input.
*/
function display()
{
$template = $this->get_template_to_use();
$tpl = new FileTemplate('framework/builder/form/FormFieldMultipleFilePicker.tpl');
$tpl->put_all(array('MAX_FILE_SIZE' => $this->get_max_file_size(), 'NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled(), 'MAX_INPUT' => $this->max_input));
$this->assign_common_template_variables($template);
$template->assign_block_vars('fieldelements', array('ELEMENT' => $tpl->render()));
return $template;
}
示例13: build_view
private function build_view()
{
$config_html = new SitemapExportConfig('sitemap/export/sitemap.html.tpl', 'sitemap/export/module_map.html.tpl', 'sitemap/export/sitemap_section.html.tpl', 'sitemap/export/sitemap_link.html.tpl');
$sitemap = SitemapService::get_personal_sitemap();
$tpl = new FileTemplate('sitemap/ViewSitemapController.tpl');
$tpl->add_lang($this->lang);
$tpl->put('SITEMAP', $sitemap->export($config_html));
return $tpl;
}
示例14: display
public function display()
{
$question_id = array_rand(self::$questions);
//Question aléatoire
$question = new QuestionCaptchaQuestion();
$question->set_properties(self::$questions[$question_id]);
$tpl = new FileTemplate('QuestionCaptcha/QuestionCaptcha.tpl');
$tpl->put_all(array('QUESTION_ID' => $question_id, 'QUESTION' => $question->get_label(), 'HTML_ID' => $this->get_html_id()));
return $tpl->render();
}
示例15: 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);
}