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