0

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. 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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Hanik
  • 317
  • 2
  • 6
  • 25
  • 1
    First of all your bind in the query is not ok. In the conditions you set it as :client_id: and you bind it as :client_number:. Didn't you dump `$this->view->client` to see if it has results? After that it should be working. – Nikolay Mihaylov Aug 09 '16 at 06:32

1 Answers1

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