Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do we pass data from controller to view in zend?

I am starting in zend framework 1.11. How do we pass different $data value in view from controller to view like in codeigniter we pass like this.

$data['pass_one_thing'] = $this->model1->pass_all_mangoes();
$data['pass_another_thing'] = $this->model2->pass_all_oranges();
$this->load->view('viewfile', $data);

then in views we get values of $pass_one_thing and $pass_another_thing with foreach loops in same view file.

how do i pass from different model function in a same view ?

How do we get such thing in zend ? I am new to zend and bit confused.

like image 836
ktm Avatar asked Feb 09 '12 15:02

ktm


1 Answers

You set it in your controller as:

$this->view->myVar = "something";

And then access it from the view:

echo $this->myVar;

Or using assign like Wesley said.

like image 116
Iznogood Avatar answered Oct 08 '22 05:10

Iznogood