layout
Zend Expressive在使用Zend View时默认为模板。我注意到PhpRendereraddTemplate($template)
类中的函数,但是在哪里以及如何添加替代模板?layout
在动作的中间件工厂中,在动作本身中,还是在其他地方?
layout
Zend Expressive在使用Zend View时默认为模板。我注意到PhpRendereraddTemplate($template)
类中的函数,但是在哪里以及如何添加替代模板?layout
在动作的中间件工厂中,在动作本身中,还是在其他地方?
layout
将键传递给数组render()
中的渲染器方法data
似乎足以在返回响应之前切换布局。
例如:
class HomeAction
{
public function __invoke($request, $response, $next)
{
$data = [
'layout' => 'layout::default',
// or 'layout::admin',
// or 'layout::alternative',
];
$body = $this->template->render('app::home', $data);
return new HtmlResponse($body);
}
}
我强烈建议观看存储库,它是 github 上的问题更新。