在 Zend Expressive 中,布局是“默认”到“模板”文件夹中。
我想像这样将“admin”文件夹添加到“templates”文件夹中:
- 模板
- 行政
- 应用程序
- 管理页面.phtml
- 错误
- 404.phtml
- 错误.phtml
- 布局
- 默认.phtml
- 应用程序
- 默认
- 应用程序
- 主页.phtml
- 错误
- 404.phtml
- 错误.phtml
- 布局
- 默认.phtml
- 应用程序
- 行政
我已经尝试使用 Zend expressive 的教程来添加新布局,但对我来说没有成功......
class AdminPageHandler implements RequestHandlerInterface
{
private $template;
public function __construct(TemplateRendererInterface $template)
{
$this->template = $template;
}
public function handle(ServerRequestInterface $request) : ResponseInterface
{
$data = [
'admin' => 'layout::admin',
// or 'layout::admin',
// or 'layout::alternative',
];
$content = $this->template->render('pages::admin-page', $data);
return new HtmlResponse($content);
}
}
如何为我的管理仪表板添加新布局?
我想为我的管理仪表板添加新布局,因为 HTML 脚本与我的主应用程序不同。