Reputation: 475
I am working in zend framework 2.I want to know in view file and layout file [.phtml] how can I access session data.
I am accessing session in controller like below:
$session = new \Zend\Session\Container('identity');
But I want to access this session on view file. can anyone help me?
Upvotes: 1
Views: 853
Reputation: 44422
You can simply pass data to your view inside your controller.
Check the documentation for examples:
$view = new ViewModel(array(
'identity' => $identity,
));
Upvotes: 1