本文整理匯總了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);
}