本文整理匯總了PHP中Presenter::formatTemplateFiles方法的典型用法代碼示例。如果您正苦於以下問題:PHP Presenter::formatTemplateFiles方法的具體用法?PHP Presenter::formatTemplateFiles怎麽用?PHP Presenter::formatTemplateFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Presenter
的用法示例。
在下文中一共展示了Presenter::formatTemplateFiles方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: formatTemplateFiles
/**
* Formats view template file names.
* @param string
* @param string
* @return array
*/
public function formatTemplateFiles($presenter, $view)
{
if ($this->oldModuleMode) {
$root = Environment::getVariable('templatesDir', Environment::getVariable('appDir') . '/templates');
// back compatibility
$presenter = str_replace(':', 'Module/', $presenter);
$dir = '';
if ($root === Environment::getVariable('appDir') . '/presenters') {
// special supported case
$pos = strrpos($presenter, '/');
$presenter = $pos === FALSE ? 'templates/' . $presenter : substr_replace($presenter, '/templates', $pos, 0);
$dir = 'templates/';
}
return array("{$root}/{$presenter}/{$view}.phtml", "{$root}/{$presenter}.{$view}.phtml", "{$root}/{$dir}@global.{$view}.phtml");
}
return parent::formatTemplateFiles($presenter, $view);
}
示例2: formatLayoutTemplateFiles
/**
* ads 'modules/' to path where to find layouts
* ads reversed order of modules to paths where to find layouts, ie. from Admin:News: to NewsModule:AdminModule
*
* @param string
* @param string
* @return array
*/
public function formatLayoutTemplateFiles($presenter, $layout)
{
$paths = parent::formatTemplateFiles($presenter, $layout);
$appDir = Environment::getVariable('appDir');
$path = '/modules/' . str_replace(':', 'Module/', $presenter);
$pathP = substr_replace($path, '/templates', strrpos($path, '/'), 0);
$list = array("{$appDir}{$pathP}/@{$layout}.phtml", "{$appDir}{$pathP}.@{$layout}.phtml", "{$appDir}{$path}Module/templates/@{$layout}.phtml");
// dump($list);die();
// dump($path);
// dump($pathP);
// dump("$appDir$pathP/@$layout.phtml");
// dump($presenter);
// ked pouzivam aj reversed order, tak nechcem prebublat az do '/app/modules/templates/@layout.phtml', resp. '/app/templates/@layout.phtml', tam sa dostanu az po skuseni reversed order
// while (($path = substr($path, 0, strrpos($path, '/'))) !== false) {
while (($path = substr($path, 0, strrpos($path, '/'))) !== "/modules") {
$list[] = "{$appDir}{$path}/templates/@{$layout}.phtml";
}
/* reversed order for modules, ie. from Admin:News: to NewsModule:AdminModule*/
$chunks = explode(':', $presenter);
// if no module [e.g. it's ErrorPresenter from no module] return - @deprecated, should not be needed
if (!isset($chunks[1])) {
return $paths;
}
$reversedModulePresenter = implode(':', array_merge(array($chunks[1], $chunks[0]), array_splice($chunks, 2)));
$reversedModulePath = '/modules/' . str_replace(':', 'Module/', $reversedModulePresenter);
$reversedModulePathP = substr_replace($reversedModulePath, '/templates', strrpos($reversedModulePath, '/'), 0);
// $reversedModulePath = substr_replace($reversedModulePath, '/templates', strrpos($reversedModulePath, '/'));
// dump($reversedModulePath);
// dump($reversedModulePathP);
$list[] = "{$appDir}{$reversedModulePathP}/@{$layout}.phtml";
$list[] = "{$appDir}{$reversedModulePathP}.@{$layout}.phtml";
while (($reversedModulePath = substr($reversedModulePath, 0, strrpos($reversedModulePath, '/'))) !== FALSE) {
$list[] = "{$appDir}{$reversedModulePath}/templates/@{$layout}.phtml";
}
// dump($paths);
// dump($list);
// die();
// return array_merge($paths, $list);
// finalize
foreach ($list as &$l) {
$l = MyTools::unifyPath($l);
// if layout is an absolute path, trim everything before
$absPathPos = strpos($l, '//');
if ($absPathPos !== false) {
$l = substr($l, $absPathPos + 2);
}
}
return array_merge($list);
}
示例3: formatTemplateFiles
/** Enable templates overriding by app folder, although theme folder overrides even this
*/
public function formatTemplateFiles()
{
$name = str_replace(":", ".", $this->getName());
$list = parent::formatTemplateFiles();
array_unshift($list, $this->context->params["appDir"] . "/templates/{$name}.{$this->view}.latte");
return $list;
}