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