本文整理汇总了PHP中League\Plates\Engine::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::make方法的具体用法?PHP Engine::make怎么用?PHP Engine::make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Plates\Engine
的用法示例。
在下文中一共展示了Engine::make方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render the template and layout.
* @param array $data
* @return string
*/
public function render(array $data = array())
{
try {
$this->data($data);
unset($data);
extract($this->data);
ob_start();
if ($this->exists()) {
include $this->path();
} else {
throw new LogicException('The template "' . $this->name->getName() . '" could not be found at "' . $this->path() . '".');
}
$content = ob_get_clean();
if (isset($this->layoutName)) {
$layout = $this->engine->make($this->layoutName);
$layout->sections = array_merge($this->sections, array('content' => $content));
$content = $layout->render($this->layoutData);
}
return $content;
} catch (LogicException $e) {
if (ob_get_length() > 0) {
ob_end_clean();
}
throw $e;
}
}
示例2: fetch
/**
* Fetch a rendered template.
* @param string $name
* @param array $data
* @return string
*/
protected function fetch($name, array $data = array())
{
//return $this->engine->render($name, $data);
$template = $this->engine->make($name);
$template->sections = $this->sections;
return $template->render($data);
}
示例3: compileFile
/**
* Parse php files
*
* @param string $filename
* @return string parsed content
*/
protected function compileFile($filename)
{
$template = $this->engine->make($filename);
$content = $template->render();
return $content;
}
示例4: makeTemplate
protected function makeTemplate($name)
{
return $this->templater->make($name);
}
示例5: body
/**
* @inheritDoc
*/
public function body(PayloadInterface $payload)
{
$template = $this->template($payload);
$template = $this->engine->make($template);
return $this->render($template, $payload);
}