本文整理汇总了PHP中TemplateLoader::getDefaultPath方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateLoader::getDefaultPath方法的具体用法?PHP TemplateLoader::getDefaultPath怎么用?PHP TemplateLoader::getDefaultPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateLoader
的用法示例。
在下文中一共展示了TemplateLoader::getDefaultPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}