Pass value from controller to view


from controller is it possible passing a variable to the view, or maybe directly assign a value to an textInput of an activeview form?

return $this->render('myview', ['model' => $model]);

or via

return $this->redirect(['myview']);

You just passed $model to the view in your first example.

$foo = 'bar';

return $this->render('demo', ['foo' => $foo]);

In demo.php:

<?= var_dump($foo); ?>

Thank you, works :slight_smile: