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


PHP Template::getName方法代码示例

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


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

示例1: parseTemplate

 /**
  * Adds a template.
  *
  * @param \Template $template The message.
  *
  * @return void
  */
 public function parseTemplate(\Template $template)
 {
     if (self::$timeCollector) {
         self::$timeCollector->startMeasure($template->getName(), 'Parse: ' . $template->getName());
         self::$timeCollector->stopMeasure($template->getName());
     }
     self::$collector->addTemplate($template);
 }
开发者ID:cyberspectrum,项目名称:contao-debugger,代码行数:15,代码来源:TemplateDebugger.php

示例2: cb_parseTemplate

 public function cb_parseTemplate(\Template &$objTemplate)
 {
     global $objPage;
     if (strpos($objTemplate->getName(), 'news_') === 0) {
         if ($objTemplate->source == 'singlefile') {
             $modelFile = \FilesModel::findByUuid($objTemplate->singlefileSRC);
             try {
                 if ($modelFile === null) {
                     throw new \Exception("no file");
                 }
                 $allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
                 if (!in_array($modelFile->extension, $allowedDownload)) {
                     throw new Exception("download not allowed by extension");
                 }
                 $objFile = new \File($modelFile->path, true);
                 $strHref = \System::urlEncode($objFile->value);
             } catch (\Exception $e) {
                 $strHref = "";
             }
             $target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
             $objTemplate->more = sprintf('<a %s href="%s" title="%s">%s</a>', $target, $strHref, specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objFile->basename)), $GLOBALS['TL_LANG']['MSC']['more']);
             $objTemplate->linkHeadline = sprintf('<a %s href="%s" title="%s">%s</a>', $target, $strHref, specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['open'], $objFile->basename)), $objTemplate->headline);
         }
     }
 }
开发者ID:kikmedia,项目名称:contao,代码行数:25,代码来源:NewsSingleFile.php

示例3: register

 public static function register(Template $uri_template)
 {
     if (!($name = $uri_template->getName())) {
         throw new \RuntimeException("Registered URI templates must have a name.");
     }
     static::$templates[$name] = $uri_template;
 }
开发者ID:phpf,项目名称:util,代码行数:7,代码来源:Manager.php

示例4: formTemplatedFrames

 public function formTemplatedFrames()
 {
     $this->data->idTemplate = $this->data->id;
     $model = new Template($this->data->idTemplate);
     $this->data->title = 'Template: ' . $model->getEntry() . '  [' . $model->getName() . ']';
     $this->data->query = Manager::getAppURL('fnbr20', 'structure/template/gridDataTemplatedFrames/' . $this->data->id);
     $this->render();
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:8,代码来源:TemplateController.php

示例5: hookParseTemplate

 /**
  * Inject the helper for the frontend templates.
  *
  * @param \Template $template The template being parsed.
  *
  * @return void
  */
 public function hookParseTemplate(\Template $template)
 {
     if (substr($template->getName(), 0, 3) === 'fe_') {
         $helper = new Helper($template);
         $template->flexibleSections = function ($position, $template = 'block_sections') use($helper) {
             echo $helper->getCustomSections($position, $template);
         };
         $template->getFlexibleSectionsHelper = function () use($helper) {
             return $helper;
         };
     }
 }
开发者ID:netzmacht,项目名称:contao-flexible-sections,代码行数:19,代码来源:HelperInjector.php

示例6: execute

 /**
  * execute all registered template modifiers
  *
  * @param \Template $template
  */
 public function execute(\Template $template)
 {
     if (!Bootstrap::isEnabled()) {
         return;
     }
     foreach ($GLOBALS['BOOTSTRAP']['templates']['modifiers'] as $config) {
         if ($config['disabled'] || !$this->isTemplateAffected($template->getName(), $config['templates'])) {
             continue;
         }
         if ($config['type'] == 'replace') {
             if (is_callable($config['replace'])) {
                 $value = call_user_func($config['replace'], $template);
             } else {
                 $value = $config['replace'];
             }
             $template->{$config}['key'] = str_replace($config['search'], $value, $template->{$config}['key']);
         } elseif ($config['type'] == 'callback') {
             call_user_func($config['callback'], $template);
         }
     }
 }
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:26,代码来源:Modifier.php

示例7: modify

 /**
  * Execute all registered template modifiers.
  *
  * @param \Template $template Current template.
  *
  * @return void
  */
 public function modify(\Template $template)
 {
     if (!Bootstrap::isEnabled()) {
         return;
     }
     foreach ((array) Bootstrap::getConfigVar('templates.modifiers') as $config) {
         if ($config['disabled'] || !$this->isTemplateAffected($template->getName(), (array) $config['templates'])) {
             continue;
         }
         if ($config['type'] == 'replace') {
             if (is_callable($config['replace'])) {
                 $value = call_user_func($config['replace'], $template);
             } else {
                 $value = $config['replace'];
             }
             $template->{$config}['key'] = str_replace($config['search'], $value, $template->{$config}['key']);
         } elseif ($config['type'] == 'callback') {
             call_user_func($config['callback'], $template);
         }
     }
 }
开发者ID:contao-bootstrap,项目名称:core,代码行数:28,代码来源:Modifier.php

示例8: createTemplate

 public function createTemplate()
 {
     try {
         $this->data->idFrame = $this->data->id;
         $model = new Template();
         $model->createFromFrame($this->data->idFrame);
         $this->renderPrompt('information', 'Template [' . $model->getName() . '] was created.');
     } catch (\Exception $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:11,代码来源:FrameController.php

示例9: Template

$templateObj = new Template($templateId);

if (!isset($_SERVER['SERVER_PORT']))
{
	$_SERVER['SERVER_PORT'] = 80;
}
$scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
$siteAlias = new Alias($publicationObj->getDefaultAliasId());
$websiteURL = $scheme.$siteAlias->getName() . $GLOBALS['Campsite']['SUBDIR'];

$accessParams = "LoginUserId=" . $g_user->getUserId() . "&LoginUserKey=" . $g_user->getKeyId()
				. "&AdminAccess=all";
if ($publicationObj->getUrlTypeId() == 1) {
	$templateObj = new Template($templateId);
	$url = "$websiteURL/tpl/" . $templateObj->getName() . "?IdLanguage=$f_language_id"
		. "&IdPublication=$f_publication_id&NrIssue=$f_issue_number&NrSection=$f_section_number"
		. "&NrArticle=$f_article_number&$accessParams";
} else {
	$url = ShortURL::GetURL($f_publication_id, $f_language_selected, null, null, $f_article_number);
	if (PEAR::isError($url)) {
		$errorStr = $url->getMessage();
	}
	$url .= '?' . $accessParams;
}

$selectedLanguage = (int)CampRequest::GetVar('f_language_selected');
$url .= "&previewLang=$selectedLanguage";
$siteTitle = (!empty($Campsite['site']['title'])) ? htmlspecialchars($Campsite['site']['title']) : putGS("Newscoop") . $Campsite['VERSION'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
开发者ID:nistormihai,项目名称:Newscoop,代码行数:30,代码来源:preview.php

示例10: parseTemplate

 public function parseTemplate(\Template $template)
 {
     if (substr($template->getName(), 0, 3) == 'ce_' && $template->imgSize) {
         $template->imgSize = '';
     }
 }
开发者ID:bit3,项目名称:contao-theme-reveal-js-basic,代码行数:6,代码来源:Hooks.php

示例11: getTemplate

    /**
     *
     */
    public function getTemplate($p_templateIdOrName = null)
    {
        if (!is_null($this->m_template)) {
            return $this->m_template->name;
        }

        if (!empty($p_templateIdOrName)) {
            $tplObj = new Template($p_templateIdOrName);
            if (!$tplObj->exists()) {
                return null;
            }
            $template = $tplObj->getName();
        } elseif (is_null($this->m_errorCode)) {
            $template = CampSystem::GetTemplate($this->language->number,
            $this->publication->identifier, $this->issue->number,
            $this->section->number, $this->article->number);
        } else {
            return null;
        }

        return $template;
    } // fn getTemplate
开发者ID:nistormihai,项目名称:Newscoop,代码行数:25,代码来源:CampURI.php

示例12: processTemplateBlocks

 protected function processTemplateBlocks(Template $template, &$globals, RendererInterface $renderer)
 {
     if ($this->benchmarkRendering) {
         $this->Benchmark->start('process-template-blocks-' . $template->getName());
     }
     $templateBlocks = $template->getTemplateBlocks();
     $data = $template->getData();
     $locals = $template->getLocals();
     $handler = $template->getContentType() != 'html' && $template->getContentType() != '' ? $template->getContentType() . '-' : '';
     $renderout = '';
     $contents = '';
     $parsedContents = '';
     $locals['DisplayRecords'] = sizeof($data);
     $locals['Count'] = 1;
     if (!empty($data)) {
         //if(LOG_ENABLE) System::log(self::$logType, 'Parsing contents block');
         if (!isset($templateBlocks[$handler . 'contents']) && !isset($templateBlocks[$handler . 'header']) && !isset($templateBlocks[$handler . 'exec'])) {
             throw new Exception('Template [' . $template->getName() . '] is missing a template block for [' . $handler . 'contents] or [' . $handler . 'header] or [' . $handler . 'exec]');
         }
         $eBlock = isset($templateBlocks[$handler . 'exec']) ? $templateBlocks[$handler . 'exec'] : '';
         $cBlock = isset($templateBlocks[$handler . 'contents']) ? $templateBlocks[$handler . 'contents'] : '';
         $ciBlock = isset($templateBlocks[$handler . 'contents-inbetween']) ? $templateBlocks[$handler . 'contents-inbetween'] : '';
         if (!empty($eBlock)) {
             $contents = $eBlock;
             $contents = $this->parseSetters($contents, $locals);
             $contents = $this->parseConditions($contents, $locals);
             $contents = $this->parseFilters($contents, $locals);
             $contents = $this->parseAssets($contents, $locals);
             // parse dependent sub modules
             $template->setLocals($locals);
             // $this->Logger->debug("Parsing dependent includes for [{$template->getName()}]...");
             $contents = $this->parseTemplateIncludes($contents, $template->getContentType(), $template, $globals, $renderer, false, true);
             $contents = $this->parseFormatVariables($contents, $locals);
             $renderout .= $contents;
         } else {
             // List Processing of the Data
             foreach ((array) $data as $row) {
                 $contents = $cBlock;
                 // if(strpos($contents, '{% set ') !== FALSE) {
                 //     while(preg_match("/(.*?)\{\%\s+set\s+([^\%]+?)\s+\%\}\s*(.*?)\s?\{\%\s+endset\s+\%\}\s*(.*)/s",$contents,$m)) {
                 //         if(!array_key_exists($m[2], $row)) {
                 //             $val = $this->parseFormatVariablesAndFilters($m[3], $row);
                 //             $row[$m[2]] = $val;
                 //         }
                 //         $contents = $m[1]. $m[4];
                 //      }
                 // }
                 if ($locals['DisplayRecords'] != $locals['Count']) {
                     $contents .= $ciBlock;
                 }
                 if (!is_array($row)) {
                     if ($row instanceof Node) {
                         /*
                          * Populating Node itself into the row so it can be used in templates,
                          * passed to events, filters, etc.  see ticket #30
                          * todo: investigate populating 'Node' in populateNodeCheaters directly
                          */
                         $node = $row;
                         $row = $this->NodeMapper->populateNodeCheaters($row)->toArray();
                         $row['Node'] = $node;
                     } else {
                         if ($row instanceof Object) {
                             $row = $row->toArray();
                         } else {
                             throw new Exception("data is not an array\n" . print_r($row, true));
                         }
                     }
                 }
                 $row_locals = array_merge($locals, $row);
                 $row_locals['SerializedData'] = $row;
                 //if(LOG_ENABLE) System::log(self::$logType, 'Locals ['.print_r($locals, true).']');
                 $contents = $this->parseSetters($contents, $row_locals);
                 $contents = $this->parseConditions($contents, $row_locals);
                 $contents = $this->parseFilters($contents, $row_locals);
                 $contents = $this->parseAssets($contents, $row_locals);
                 // parse dependent sub modules
                 $template->setLocals($row_locals);
                 // $this->Logger->debug("Parsing dependent includes for [{$template->getName()}]...");
                 $contents = $this->parseTemplateIncludes($contents, $template->getContentType(), $template, $globals, $renderer, false, true);
                 $contents = $this->parseFormatVariables($contents, $row_locals);
                 $locals['Count']++;
                 $parsedContents .= $contents;
             }
             $locals = $row_locals;
             $template->setLocals($locals);
             // headers and footers can use format variables from the final row
             $renderout = '';
             if (!empty($templateBlocks[$handler . 'header'])) {
                 $header = $templateBlocks[$handler . 'header'];
                 $header = $this->parseSetters($header, $locals);
                 $header = $this->parseConditions($header, $locals);
                 $header = $this->parseFilters($header, $locals);
                 $header = $this->parseAssets($header, $locals);
                 $template->setLocals($locals);
                 // parse dependent sub modules
                 $header = $this->parseTemplateIncludes($header, $template->getContentType(), $template, $globals, $renderer, false, true);
                 $header = $this->parseFormatVariables($header, $locals);
                 $renderout .= $header;
             }
             $renderout .= $parsedContents;
//.........这里部分代码省略.........
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:101,代码来源:CFTemplateEngine.php

示例13: i_fromINI

 /**
  * A utility function to load a template from an .ini file which does
  * _not_ perform static initialization and therefore can be used during
  * static initialization.
  * @param string $filename The filename of the .ini file to load.
  * @param \EVought\vCardTools\Template $fallback A Template to use as a fallback
  * for undefined fragments. If null, this method will look for '_fallback'
  * in the .ini file and will use it, *if* a Template by that name is
  * registered.
  * @return \EVought\vCardTools\Template 
  * @throws \DomainException If the file does not exist or is not readable.
  * @throws \DomainException If the key '_template' in the .ini file does
  * not contain the expected components.
  * @throws \RuntimeException If an error occurs while reading the .ini file.
  */
 private static function i_fromINI($filename, Template $fallback = null)
 {
     assert(!empty($filename), '$filename may not be empty');
     if (!is_readable($filename)) {
         throw new \DomainException('Filename, ' . $filename . 'must exist and be readable');
     }
     $fragments = parse_ini_file($filename);
     if (false === $fragments) {
         throw new \RuntimeException('Failed to load INI file ' . $filename);
     }
     if (null === $fallback && array_key_exists('_fallback', $fragments) && array_key_exists($fragments['_fallback'], self::$templateRegistry)) {
         $fallback = self::$templateRegistry[$fragments['_fallback']];
     }
     if (null === $fallback && array_key_exists('_fallback_file', $fragments)) {
         $fallback = self::i_fromINI($fragments['_fallback_file']);
     }
     unset($fragments['_fallback']);
     unset($fragments['_fallback_file']);
     if (array_key_exists('_template', $fragments)) {
         if (!is_array($fragments['_template'])) {
             throw new \DomainException('_template must be an array and ' . 'should contain informational ' . 'keys and values about the ' . 'Template');
         }
         $info = TemplateInfo::fromArray($fragments['_template']);
         unset($fragments['_template']);
     } else {
         $info = new TemplateInfo();
     }
     $template = new Template($fragments, $fallback, $info);
     if (null !== $template->getName()) {
         self::$templateRegistry[$template->getName()] = $template;
     }
     return $template;
 }
开发者ID:evought,项目名称:vcard-tools,代码行数:48,代码来源:Template.php

示例14: parseTemplate

 /**
  * parseTemplate hook for articles and events
  *
  * @param \Template $objTempalte
  */
 public function parseTemplate(\Template $objTemplate)
 {
     // check for mod_article template
     if (stripos($objTemplate->getName(), 'mod_article') !== false) {
         // prepare sharebuttons string
         $strSharebuttons = '';
         // get the networks
         $arrNetworks = deserialize($objTemplate->sharebuttons_networks);
         // check if there are any networks
         if ($arrNetworks) {
             // set data
             $networks = $arrNetworks;
             $theme = $objTemplate->sharebuttons_theme;
             $template = $objTemplate->sharebuttons_template;
             $url = $objTemplate->href;
             $title = $objTemplate->title;
             $description = $objTemplate->teaser;
             // create the share buttons
             $strSharebuttons = self::createShareButtons($networks, $theme, $template, $url, $title, $description);
         }
         // set sharebuttons variable
         $objTemplate->sharebuttons = $strSharebuttons;
     } elseif (stripos($objTemplate->getName(), 'event_') === 0) {
         // prepare sharebuttons string
         $strSharebuttons = '';
         // get the calendar
         if (($objCalendar = \CalendarModel::findById($objTemplate->pid)) !== null) {
             // get the networks
             $arrNetworks = deserialize($objCalendar->sharebuttons_networks);
             // check if there are any networks
             if ($arrNetworks) {
                 // set data
                 $networks = $arrNetworks;
                 $theme = $objCalendar->sharebuttons_theme;
                 $template = $objCalendar->sharebuttons_template;
                 $url = $objTemplate->href;
                 $title = $objTemplate->title;
                 $description = $objTemplate->teaser;
                 $image = $objTemplate->singleSRC;
                 // create the share buttons
                 $strSharebuttons = self::createShareButtons($networks, $theme, $template, $url, $title, $description, $image);
             }
         }
         // set sharebuttons variable
         $objTemplate->sharebuttons = $strSharebuttons;
     }
 }
开发者ID:fritzmg,项目名称:contao-sharebuttons,代码行数:52,代码来源:ShareButtons.php

示例15: hookParseTemplate

 /**
  * ParseTemplate hook being used to beatify the backend view.
  *
  * @param \Template $template The template.
  *
  * @return void
  */
 public function hookParseTemplate(\Template $template)
 {
     if (TL_MODE == 'BE' && $template->getName() == 'be_subcolumns' && Bootstrap::getConfigVar('grid-editor.backend.replace-subcolumns-template')) {
         $template->setName('be_subcolumns_bootstrap');
     }
 }
开发者ID:contao-bootstrap,项目名称:grid-editor,代码行数:13,代码来源:Subcolumns.php


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