本文整理汇总了PHP中TemplateLoader类的典型用法代码示例。如果您正苦于以下问题:PHP TemplateLoader类的具体用法?PHP TemplateLoader怎么用?PHP TemplateLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TemplateLoader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDefaultRobots
public function getDefaultRobots()
{
$oldPath = craft()->path->getTemplatesPath();
$newPath = craft()->path->getPluginsPath() . 'seomatic/templates';
craft()->path->setTemplatesPath($newPath);
/* -- Return the robots.txt default template */
$templateName = '_robotsDefault';
$loader = new TemplateLoader();
$template = $loader->getSource($templateName);
craft()->path->setTemplatesPath($oldPath);
return $template;
}
开发者ID:chrisg2g,项目名称:seomatic,代码行数:12,代码来源:Seomatic_SettingsRecord.php
示例2: parse
/**
* Parse the template file and return it as string
*
* @return string The template markup
*/
public function parse()
{
$strBuffer = '';
// Start with the template itself
$this->strParent = $this->strTemplate;
// Include the parent templates
while ($this->strParent !== null) {
$strCurrent = $this->strParent;
$strParent = $this->strDefault ?: $this->getTemplate($this->strParent, $this->strFormat);
// Reset the flags
$this->strParent = null;
$this->strDefault = null;
ob_start();
include $strParent;
// Capture the output of the root template
if ($this->strParent === null) {
$strBuffer = ob_get_contents();
} elseif ($this->strParent == $strCurrent) {
$this->strDefault = \TemplateLoader::getDefaultPath($this->strParent, $this->strFormat);
}
ob_end_clean();
}
// Reset the internal arrays
$this->arrBlocks = array();
// Add start and end markers in debug mode
if (\Config::get('debugMode')) {
$strRelPath = str_replace(TL_ROOT . '/', '', $this->getTemplate($this->strTemplate, $this->strFormat));
$strBuffer = "\n<!-- TEMPLATE START: {$strRelPath} -->\n{$strBuffer}\n<!-- TEMPLATE END: {$strRelPath} -->\n";
}
return $strBuffer;
}
开发者ID:eknoes,项目名称:core,代码行数:36,代码来源:BaseTemplate.php
示例3: getTemplateGroup
/**
* Return all template files of a particular group as array
*
* @param string $strPrefix The template name prefix (e.g. "ce_")
*
* @return array An array of template names
*/
public static function getTemplateGroup($strPrefix)
{
$arrTemplates = array();
// Get the default templates
foreach (\TemplateLoader::getPrefixedFiles($strPrefix) as $strTemplate) {
$arrTemplates[$strTemplate][] = 'root';
}
$arrCustomized = glob(TL_ROOT . '/templates/' . $strPrefix . '*');
// Add the customized templates
if (is_array($arrCustomized)) {
foreach ($arrCustomized as $strFile) {
$strTemplate = basename($strFile, strrchr($strFile, '.'));
$arrTemplates[$strTemplate][] = $GLOBALS['TL_LANG']['MSC']['global'];
}
}
// Do not look for back end templates in theme folders (see #5379)
if ($strPrefix != 'be_' && $strPrefix != 'mail_') {
// Try to select the themes (see #5210)
try {
$objTheme = \ThemeModel::findAll(array('order' => 'name'));
} catch (\Exception $e) {
$objTheme = null;
}
// Add the theme templates
if ($objTheme !== null) {
while ($objTheme->next()) {
if ($objTheme->templates != '') {
$arrThemeTemplates = glob(TL_ROOT . '/' . $objTheme->templates . '/' . $strPrefix . '*');
if (is_array($arrThemeTemplates)) {
foreach ($arrThemeTemplates as $strFile) {
$strTemplate = basename($strFile, strrchr($strFile, '.'));
if (!isset($arrTemplates[$strTemplate])) {
$arrTemplates[$strTemplate][] = $objTheme->name;
} else {
$arrTemplates[$strTemplate][] = $objTheme->name;
}
}
}
}
}
}
}
// Show the template sources (see #6875)
foreach ($arrTemplates as $k => $v) {
$v = array_filter($v, function ($a) {
return $a != 'root';
});
if (empty($v)) {
$arrTemplates[$k] = $k;
} else {
$arrTemplates[$k] = $k . ' (' . implode(', ', $v) . ')';
}
}
// Sort the template names
ksort($arrTemplates);
return $arrTemplates;
}
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:64,代码来源:Controller.php
示例4: initializeLayout
/**
* only load templates if bootstrap is activated, so diverent layouts will work instead of template changes
*
* @param \PageModel $page
* @param \LayoutModel $layout
*/
public function initializeLayout($page, \LayoutModel $layout)
{
static::$pageLayout = $layout;
if (!static::isEnabled()) {
return;
}
// reset default framework
static::$pageLayout->framework = null;
$templates = $GLOBALS['BOOTSTRAP']['templates']['dynamicLoad'];
// only load these templates if layout uses it because default templates are changed
foreach ($templates as $path => $templates) {
foreach ($templates as $template) {
\TemplateLoader::addFile($template, $path);
}
}
}
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:22,代码来源:Bootstrap.php
示例5: chooseTemplates
/**
* Choose the right template
*/
public function chooseTemplates()
{
// do not choose backend templates in the frontend see #27
if (TL_MODE == "FE") {
return;
}
// check theme for back end user
/** @var \BackendUser $objUser */
$objUser = \Controller::importStatic('BackendUser');
$loggedIn = $this->beUserLoggedIn($objUser);
$theme = $objUser->backendTheme;
if ($loggedIn === false && \Config::get('backendTheme') != "sb-admin" || $theme !== null && $theme != "sb-admin") {
return;
}
// modified templates
$arrTemplate = array('be_changelog', 'be_chart_panel', 'be_confirm', 'be_diff', 'be_error', 'be_forbidden', 'be_help', 'be_incomplete', 'be_install', 'be_login', 'be_main', 'be_navigation', 'be_no_active', 'be_no_forward', 'be_no_layout', 'be_no_page', 'be_no_root', 'be_pagination', 'be_password', 'be_picker', 'be_popup', 'be_purge_data', 'be_referer', 'be_switch', 'be_unavailable', 'be_welcome');
// Register the template
foreach ($arrTemplate as $value) {
\TemplateLoader::addFile($value, 'system/modules/sb-admin/templates/backend');
}
}
开发者ID:zeromax,项目名称:contao-sb-admin,代码行数:24,代码来源:SbTemplate.php
示例6: getTemplatePath
/**
* Find a particular template file and return its path
*
* @param string $strTemplate The name of the template
* @param string $strFormat The file extension
* @param boolean $blnDefault If true, the default template path is returned
*
* @return string The path to the template file
*/
protected function getTemplatePath($strTemplate, $strFormat = 'html5', $blnDefault = false)
{
if ($blnDefault) {
return \TemplateLoader::getDefaultPath($strTemplate, $strFormat);
}
return \Controller::getTemplate($strTemplate, $strFormat);
}
开发者ID:Mozan,项目名称:core-bundle,代码行数:16,代码来源:TemplateInheritance.php
示例7:
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2014 Leo Feyer
*
* @package Newsletter
* @link https://contao.org
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
/**
* Register the classes
*/
ClassLoader::addClasses(array('Contao\\Newsletter' => 'system/modules/newsletter/classes/Newsletter.php', 'Contao\\NewsletterChannelModel' => 'system/modules/newsletter/models/NewsletterChannelModel.php', 'Contao\\NewsletterModel' => 'system/modules/newsletter/models/NewsletterModel.php', 'Contao\\NewsletterRecipientsModel' => 'system/modules/newsletter/models/NewsletterRecipientsModel.php', 'Contao\\ModuleNewsletterList' => 'system/modules/newsletter/modules/ModuleNewsletterList.php', 'Contao\\ModuleNewsletterReader' => 'system/modules/newsletter/modules/ModuleNewsletterReader.php', 'Contao\\ModuleSubscribe' => 'system/modules/newsletter/modules/ModuleSubscribe.php', 'Contao\\ModuleUnsubscribe' => 'system/modules/newsletter/modules/ModuleUnsubscribe.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('mod_newsletter' => 'system/modules/newsletter/templates/modules', 'mod_newsletter_list' => 'system/modules/newsletter/templates/modules', 'mod_newsletter_reader' => 'system/modules/newsletter/templates/modules', 'nl_default' => 'system/modules/newsletter/templates/newsletter'));
开发者ID:iCodr8,项目名称:core,代码行数:19,代码来源:autoload.php
示例8:
<?php
/**
* The MetaModels extension allows the creation of multiple collections of custom items,
* each with its own unique set of selectable attributes, with attribute extendability.
* The Front-End modules allow you to build powerful listing and filtering of the
* data in each collection.
*
* PHP version 5
* @package MetaModels
* @subpackage AttributeNumeric
* @author Christian Schiffler <[email protected]>
* @author Stefan Heimes <[email protected]>
* @author Andreas Isaak <[email protected]>
* @author David Greminger <[email protected]>
* @copyright The MetaModels team.
* @license LGPL.
* @filesource
*/
/**
* Register the templates
*/
TemplateLoader::addFiles(array('mm_attr_numeric' => 'system/modules/metamodelsattribute_numeric/templates'));
开发者ID:zonky2,项目名称:attribute_numeric,代码行数:23,代码来源:autoload.php
示例9:
<?php
/**
* Dropbox tools extension for Contao Open Source CMS
*
* Copyright (C) 2015 Davide Rocchi
*
* @package dropbox_tools
* @author Davide Rocchi <http://www.daviderocchi.it>
* @license LGPL
*/
/**
* Register the namespace
*/
ClassLoader::addNamespace('DropboxTools');
/**
* Register the classes
*/
ClassLoader::addClasses(array('DropboxTools\\DropboxClient' => 'system/modules/dropbox_tools/classes/DropboxClient.php', 'DropboxTools\\WidgetDropboxChooser' => 'system/modules/dropbox_tools/widgets/WidgetDropboxChooser.php', 'DropboxTools\\ContentDropboxDownloads' => 'system/modules/dropbox_tools/elements/ContentDropboxDownloads.php', 'DropboxTools\\ContentDropboxToolsTest' => 'system/modules/dropbox_tools/elements/ContentDropboxToolsTest.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('ce_dropbox_downloads' => 'system/modules/dropbox_tools/templates/elements', 'ce_dropboxtoolstest' => 'system/modules/dropbox_tools/templates/elements'));
开发者ID:rocchidavide,项目名称:contao-dropbox_tools,代码行数:23,代码来源:autoload.php
示例10:
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2016 Leo Feyer
*
* @license LGPL-3.0+
*/
/**
* Register the namespaces
*/
ClassLoader::addNamespaces(array('Hofff'));
/**
* Register the classes
*/
ClassLoader::addClasses(array('Hofff\\Contao\\Calendarfield\\FormCalendarField' => 'system/modules/hofff_calendarfield/forms/FormCalendarField.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('form_calendarfield' => 'system/modules/hofff_calendarfield/templates/forms'));
开发者ID:hofff,项目名称:contao-calendarfield,代码行数:21,代码来源:autoload.php
示例11:
<?php
/**
* news_categories extension for Contao Open Source CMS
*
* Copyright (C) 2011-2014 Codefog
*
* @package news_categories
* @author Webcontext <http://webcontext.com>
* @author Codefog <[email protected]>
* @author Kamil Kuzminski <[email protected]>
* @license LGPL
*/
/**
* Register the namespace
*/
ClassLoader::addNamespace('NewsCategories');
/**
* Register the classes
*/
ClassLoader::addClasses(array('NewsCategories\\News' => 'system/modules/news_categories/classes/News.php', 'NewsCategories\\NewsCategories' => 'system/modules/news_categories/classes/NewsCategories.php', 'NewsCategories\\ContentNewsFilter' => 'system/modules/news_categories/elements/ContentNewsFilter.php', 'NewsCategories\\NewsCategoryModel' => 'system/modules/news_categories/models/NewsCategoryModel.php', 'NewsCategories\\NewsCategoryMultilingualModel' => 'system/modules/news_categories/models/NewsCategoryMultilingualModel.php', 'NewsCategories\\NewsModel' => 'system/modules/news_categories/models/NewsModel.php', 'NewsCategories\\ModuleNewsCategories' => 'system/modules/news_categories/modules/ModuleNewsCategories.php', 'NewsCategories\\ModuleNewsArchive' => 'system/modules/news_categories/modules/ModuleNewsArchive.php', 'NewsCategories\\ModuleNewsList' => 'system/modules/news_categories/modules/ModuleNewsList.php', 'NewsCategories\\ModuleNewsMenu' => 'system/modules/news_categories/modules/ModuleNewsMenu.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('mod_newscategories' => 'system/modules/news_categories/templates/modules', 'nav_newscategories' => 'system/modules/news_categories/templates/navigation'));
开发者ID:codefog,项目名称:contao-news_categories,代码行数:25,代码来源:autoload.php
示例12:
<?php
/**
* Responsive Navigation Extension for Contao
*
* Copyright (c) 2016 Falko Schumann
*
* @package ResponsiveNavigation
* @link https://github.com/falkoschumann/contao-responsive-navigation
* @license http://opensource.org/licenses/MIT MIT
*/
/**
* Register the templates.
*/
TemplateLoader::addFiles(array('j_responsive_navigation' => 'system/modules/responsive-navigation/templates/jquery'));
开发者ID:falkoschumann,项目名称:contao-responsive-navigation,代码行数:15,代码来源:autoload.php
示例13:
<?php
/**
* The MetaModels extension allows the creation of multiple collections of custom items,
* each with its own unique set of selectable attributes, with attribute extendability.
* The Front-End modules allow you to build powerful listing and filtering of the
* data in each collection.
*
* PHP version 5
*
* @package MetaModels
* @subpackage AttributeTranslatedLongtext
* @author Christian Schiffler <[email protected]>
* @author Andreas Isaak <[email protected]>
* @author Christopher Boelter <[email protected]>
* @copyright The MetaModels team.
* @license LGPL.
* @filesource
*/
/**
* Register the templates
*/
TemplateLoader::addFiles(array('mm_attr_translatedlongtext' => 'system/modules/metamodelsattribute_translatedlongtext/templates'));
开发者ID:designs2,项目名称:attribute_translatedlongtext,代码行数:23,代码来源:autoload.php
示例14:
<?php
/**
* Extension for Contao Open Source CMS
*
* Copyright (C) 2009 - 2016 terminal42 gmbh
*
* @package easy_themes
* @link http://www.terminal42.ch
* @license http://opensource.org/licenses/lgpl-3.0.html LGPL
*/
/**
* Register the classes
*/
ClassLoader::addClasses(array('CheckBoxChooseAtLeastOne' => 'system/modules/easy_themes/CheckBoxChooseAtLeastOne.php', 'EasyThemes' => 'system/modules/easy_themes/EasyThemes.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('be_easythemes' => 'system/modules/easy_themes/templates'));
开发者ID:terminal42,项目名称:contao-easy_themes,代码行数:19,代码来源:autoload.php
示例15:
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2015 Leo Feyer
*
* @package aparat
* @author Hamid Abbaszadeh
* @license GNU/GPL2
* @copyright respinar 2014-2015
*/
/**
* Register the namespaces
*/
ClassLoader::addNamespaces(array('aparat'));
/**
* Register the classes
*/
ClassLoader::addClasses(array('aparat\\ContentAparat' => 'system/modules/aparat/elements/ContentAparat.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('ce_aparat' => 'system/modules/aparat/templates/elements'));
开发者ID:respinar,项目名称:contao-aparat,代码行数:24,代码来源:autoload.php
示例16:
<?php
/**
* PHP version 5
* @package dc-general
* @author Christian Schiffler <[email protected]>
* @author Stefan Heimes <[email protected]>
* @author Tristan Lins <[email protected]>
* @copyright Contao Community Alliance.
* @license LGPL.
* @filesource
*/
/**
* Register the classes
*/
ClassLoader::addClasses(array('DC_General' => 'system/modules/dc-general/DC_General.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('dcbe_general_edit' => 'system/modules/dc-general/templates', 'dcbe_general_field' => 'system/modules/dc-general/templates', 'dcbe_general_language_panel' => 'system/modules/dc-general/templates', 'dcbe_general_listView' => 'system/modules/dc-general/templates', 'dcbe_general_listView_sorting' => 'system/modules/dc-general/templates', 'dcbe_general_panel' => 'system/modules/dc-general/templates', 'dcbe_general_panel_filter' => 'system/modules/dc-general/templates', 'dcbe_general_panel_limit' => 'system/modules/dc-general/templates', 'dcbe_general_panel_search' => 'system/modules/dc-general/templates', 'dcbe_general_panel_sort' => 'system/modules/dc-general/templates', 'dcbe_general_panel_submit' => 'system/modules/dc-general/templates', 'dcbe_general_parentView' => 'system/modules/dc-general/templates', 'dcbe_general_show' => 'system/modules/dc-general/templates', 'dcbe_general_treeview' => 'system/modules/dc-general/templates', 'dcbe_general_treeview_child' => 'system/modules/dc-general/templates', 'dcbe_general_treeview_entry' => 'system/modules/dc-general/templates', 'dcbe_general_breadcrumb' => 'system/modules/dc-general/templates', 'dcbe_general_grouping' => 'system/modules/dc-general/templates', 'widget_treepicker' => 'system/modules/dc-general/templates', 'widget_treepicker_popup' => 'system/modules/dc-general/templates', 'widget_treepicker_entry' => 'system/modules/dc-general/templates', 'widget_treepicker_child' => 'system/modules/dc-general/templates'));
开发者ID:amenk,项目名称:dc-general,代码行数:20,代码来源:autoload.php
示例17:
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2015 Leo Feyer
*
* @license LGPL-3.0+
*/
/**
* Register the classes
*/
ClassLoader::addClasses(array('AjaxLayout' => 'system/modules/ajax_layout/classes/AjaxLayout.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('fe_page_ajax' => 'system/modules/ajax_layout/templates'));
开发者ID:fritzmg,项目名称:contao-ajax-layout,代码行数:17,代码来源:autoload.php
示例18:
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2014 Leo Feyer
*
* @package Inserttag_download
* @link https://contao.org
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
/**
* Register the namespaces
*/
ClassLoader::addNamespaces(array('HeimrichHannot'));
/**
* Register the classes
*/
ClassLoader::addClasses(array('HeimrichHannot\\InserttagDownload' => 'system/modules/inserttag_download/classes/InserttagDownload.php', 'ContentDownloadInserttag' => 'system/modules/inserttag_download/classes/ContentDownloadInserttag.php'));
/**
* Register the templates
*/
TemplateLoader::addFiles(array('ce_download_inserttag' => 'system/modules/inserttag_download/templates/elements', 'block_searchable_inline' => 'system/modules/inserttag_download/templates/blocks'));
开发者ID:heimrichhannot,项目名称:contao-inserttag_download,代码行数:23,代码来源:autoload.php
示例19:
<?php
/**
* Contao Open Source CMS
*
* Copyright (c) 2005-2015 Leo Feyer
*
* @license LGPL-3.0+
*/
// Classes
ClassLoader::addClasses(array('Contao\\News' => 'vendor/contao/news-bundle/src/Resources/contao/classes/News.php', 'Contao\\NewsArchiveModel' => 'vendor/contao/news-bundle/src/Resources/contao/models/NewsArchiveModel.php', 'Contao\\NewsFeedModel' => 'vendor/contao/news-bundle/src/Resources/contao/models/NewsFeedModel.php', 'Contao\\NewsModel' => 'vendor/contao/news-bundle/src/Resources/contao/models/NewsModel.php', 'Contao\\ModuleNews' => 'vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNews.php', 'Contao\\ModuleNewsArchive' => 'vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsArchive.php', 'Contao\\ModuleNewsList' => 'vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsList.php', 'Contao\\ModuleNewsMenu' => 'vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsMenu.php', 'Contao\\ModuleNewsReader' => 'vendor/contao/news-bundle/src/Resources/contao/modules/ModuleNewsReader.php'));
// Templates
TemplateLoader::addFiles(array('mod_newsarchive' => 'vendor/contao/news-bundle/src/Resources/contao/templates/modules', 'mod_newslist' => 'vendor/contao/news-bundle/src/Resources/contao/templates/modules', 'mod_newsmenu' => 'vendor/contao/news-bundle/src/Resources/contao/templates/modules', 'mod_newsreader' => 'vendor/contao/news-bundle/src/Resources/contao/templates/modules', 'news_full' => 'vendor/contao/news-bundle/src/Resources/contao/templates/news', 'news_latest' => 'vendor/contao/news-bundle/src/Resources/contao/templates/news', 'news_short' => 'vendor/contao/news-bundle/src/Resources/contao/templates/news', 'news_simple' => 'vendor/contao/news-bundle/src/Resources/contao/templates/news'));
开发者ID:burguin,项目名称:test02,代码行数:13,代码来源:autoload.php
示例20:
<?php
/**
* Register the templates
*/
TemplateLoader::addFiles(array('be_css_class_replacer_update' => 'system/modules/css-class-replacer/templates'));
开发者ID:toflar,项目名称:contao-css-class-replacer,代码行数:6,代码来源:autoload.php
注:本文中的TemplateLoader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论