1

Here is my Code, how to and pass data from controller to layout

   $arr = array();
   $arr['layout'] = 'example';
   $this->layout()->calllayout = $arr;
Maulik Patel
  • 650
  • 5
  • 22

2 Answers2

0

try like this

$this->layout()->setVariable('var', $data);
D Coder
  • 572
  • 4
  • 16
0

Before ViewModel Write serVariable by $this->layout() like:

$arr = array();
$arr['layout'] = 'example';
$this->layout()->setVariable('variableName', $arr);

and Access it like :

echo $this->variableName['layout'];
akond
  • 15,865
  • 4
  • 35
  • 55
Maulik Patel
  • 650
  • 5
  • 22