Sergey Scopin
Sergey Scopin

Reputation: 2245

Can't get params in view passed by render. Yii2

I'm rendering another view in my view.

use yii\base\View;
    echo $this->render('current-view',array('test'=>'teeest'));

Now in other view - current-view.php I want to get access to this parametres:

use yii\base\View;
var_dump($params);
var_dump(Yii::$app->view->params); 

$params returns Null and $app->view->params returns empty array. As I understand from here proper solution is second one, but why array is empty then? What I missing?

Upvotes: 0

Views: 933

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

For see th content of you var you should use

var_dump($test);

you have passed 'test' in you render and then in view you should have $test

Upvotes: 1

Related Questions