我想根据路由参数在 Phalcon 中加载部分视图。
我有此操作,它确定部分的名称:
public function addAction($discipline = null)
{
if (isset($discipline)) {
$this->view->partial = 'add' . $discipline . '.phtml';
} else {
$this->view->partial = 'addstatic.phtml';
}
}
在主视图中,我想用 Volt 命令partial
加载此部分,如下所示:
{{ partial('partials/training/' ~ partial) }}
但是我面临此错误:
View 'C:xampphtdocsapneist_social/app/views/partials/training/addstatic.phtml' was not found in the views directory
如果我使用目录浏览器浏览到此文件,我可以找到该文件。
删除扩展名 (.phtml)。喜欢:
$this->view->partial = 'addstatic';
等一下,为什么你使用volt并想在addsta中使用phtml?随时随地使用伏特:D