本文整理汇总了PHP中League\Plates\Engine::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::getData方法的具体用法?PHP Engine::getData怎么用?PHP Engine::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Plates\Engine
的用法示例。
在下文中一共展示了Engine::getData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create new Template instance.
* @param Engine $engine
* @param string $name
*/
public function __construct(Engine $engine, $name)
{
set_error_handler(array($this, 'renderErrorHandler'));
$this->engine = $engine;
$this->name = new Name($engine, $name);
$this->data($this->engine->getData($name));
}
示例2: loadTemplate
/**
* Loads the template.
*
* @param string $template The template relative path
* @param array $vars The template variables
*
* @throws TemplateNotFoundException When template does not exist
* @throws UnsupportedTemplateException When template format is not supported
*
* @return TemplateInterface
*/
public function loadTemplate($template, array $vars = [])
{
if (!$this->supports($template)) {
throw new UnsupportedTemplateException(sprintf('Template %s is not supported by this engine.', $template));
}
if (!$this->exists($template)) {
throw new TemplateNotFoundException(sprintf('Template %s does not exist.', $template));
}
return new Template($this->plates->path($template), array_merge($this->plates->getData(), $vars));
}
示例3: __construct
/**
* Create new Template instance.
* @param Engine $engine
* @param string $name
*/
public function __construct(Engine $engine, $name)
{
$this->engine = $engine;
$this->name = new Name($engine, $name);
$this->data($this->engine->getData($name));
}