繁体   English   中英

phalcon:如何将参数传递给 setTemplateAfter 的部分电压

[英]phalcon: how pass parameters to partial volt which setTemplateAfter

我有一个名为 head 的局部视图,我在索引视图之前渲染了这个局部视图,我从模型中获取了客户端信息,然后我想将此客户端模型传递给头部局部视图,但我不能。 这是我的代码:

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();
}

这是我的基本控制器

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']
        ]
    ]);
}

如何将这个客户端模型传递给头部部分?

{{ partial('<FILE_HERE>', ['test':true] ) }}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM