本文整理汇总了PHP中Templates::is_absolute_path方法的典型用法代码示例。如果您正苦于以下问题:PHP Templates::is_absolute_path方法的具体用法?PHP Templates::is_absolute_path怎么用?PHP Templates::is_absolute_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Templates
的用法示例。
在下文中一共展示了Templates::is_absolute_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_path_for
public function view_path_for($template)
{
if (Templates::is_absolute_path($template)) {
return $template;
}
foreach ((array) $this->views_path as $path) {
$controller_path = Templates::add_extension("{$path}/{$template}", '.phtml');
if (IO_FS::exists($controller_path)) {
return $controller_path;
}
}
return $template;
}
示例2: template
public function template($data = array(), $name = 'template')
{
static $template = array();
if (Templates::is_absolute_path($name)) {
return $name;
}
if (isset($data['template'])) {
$data_templates = is_string($data['template']) ? array('template' => $data['template']) : $data['template'];
if (isset($data_templates[$name]) && IO_FS::exists($data_templates[$name])) {
return $data_templates[$name];
}
}
$type = isset($data['type']) ? $data['type'] : 'input';
$key = $type . '_' . $name;
if (isset($template[$key])) {
return $template[$key];
}
/*if ($name == 'template' && isset($data['template name']))
$name = $data['template name'];*/
$file = $this->dir() . "/{$name}.phtml";
if (IO_FS::exists($file)) {
return $template[$key] = $file;
}
$types = array($type);
$parents = Core_Types::class_hierarchy_for($this);
if (count($parents) >= 3) {
foreach (array_slice($parents, 1, count($parents) - 2) as $p) {
$type = CMS_Fields::type_by_class($p);
if (empty($type)) {
$type = CMS_Fields::type_by_class(Core_Types::module_name_for($p));
}
$types[] = $type;
}
}
foreach ($types as $t) {
if (empty($t)) {
continue;
}
$view = Templates_HTML::Template('fields/' . $t . '/' . $name);
if ($view->exists()) {
return $template[$key] = $view->path;
}
}
$view = Templates_HTML::Template('fields/' . $name);
if ($view->exists()) {
return $template[$key] = $view->path;
}
return $template[$key] = $name;
}
示例3: get_partial_path
/**
* Возвращает путь до partial шаблона
*
* @param string $name
*
* @return string
*/
protected function get_partial_path($name, $paths = array())
{
if (Core_Strings::starts_with($name, '!')) {
$trace = debug_backtrace();
foreach ($trace as $k => $t) {
if (Core_Strings::ends_with($t['file'], $this->extension)) {
break;
}
}
return Templates::add_extension(dirname($trace[$k]['file']) . '/' . substr($name, 1), $this->extension);
}
$file = Templates::add_extension($name, $this->extension);
if (Templates::is_absolute_path($name)) {
return $file;
}
$paths = array_merge($paths, $this->partial_paths(), Templates::option('templates_root'));
foreach ($paths as $path) {
$result = rtrim($path, '/') . '/' . $file;
if (is_file($result)) {
return $result;
}
}
return $result;
}