0
我有一个phalcon应用程序,它实现了多个子模块。文件夹结构如下所示:用多个视图目录渲染视图
root
app
controllers
models
views
modules
restaurants
controllers
models
views
tables
controllers
models
views
chairs
controllers
models
views
public
views目录指向modules文件夹。这样,当我必须选择一个视图时,我可以这样做:$this->view->pick('tables/views/index')
。
现在,我的问题是,当我想渲染一个视图(即获得纯html作为一个字符串),我似乎无法做到这一点。
$this->view->disable();
$this->view->pick('restaurants/views/pdf');
$html = $this->view->getContent();
$html = utf8_encode($html);
$pdf = new mPDF();
$pdf->WriteHTML($html);
$pdf->SetTitle('This is a test');
$pdf->Output('test.pdf', "I");
我可以做/解决这个问题吗?
查看https://docs.phalconphp.com/en/latest/reference/views.html#stand-alone-component – Timothy