[英]phalcon: how pass parameters to partial volt which setTemplateAfter
I have a partial view called head and I render this partial before index view and i got client information from model and then i want to pass this client model to head partial but i can not.我有一个名为 head 的局部视图,我在索引视图之前渲染了这个局部视图,我从模型中获取了客户端信息,然后我想将此客户端模型传递给头部局部视图,但我不能。 this is my code :
这是我的代码:
class IndexController extends ControllerBase
{
public function initialize()
{
$this->tag->setTitle($this->lang('index')->_('title'));
$this->view->setTemplateAfter('header');
$this->view->setTemplateBefore('footer');
}
public function indexAction()
{
$this->view->t = $this->lang('index');
$this->view->client = $this->getClient();
}
this is my base controller这是我的基本控制器
class ControllerBase extends Controller
{
public function getClient()
{
$auth = $this->session->get('auth');
return Client::findFirst([
"client_id = :client_id:",
'bind' => [
'client_number' => $auth['client_id']
]
]);
}
how can pass this client model to head partial?如何将这个客户端模型传递给头部部分?
{{ partial('<FILE_HERE>', ['test':true] ) }}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.