Reputation: 29
I used zendframwork, this is my code in controller
$getRows = $this->MgGeneral->select();
foreach($getRows as $value) {
var_dump($value);
}
i want send $getRow
to view
but it's in object (array in array), so what i need pass to view
true is $value
that i var_dump it's show
So how i can pass $value
to view
?
Upvotes: 0
Views: 55
Reputation: 29
Thanks to @Harry
by your answer now i get correct by
$passtoview = array();
$getRows = $this->MgGeneral->select();
foreach($getRows as $value) {
$passtoview[] = $value;
};
var_dump($passtoview);
Upvotes: 2
Reputation: 1398
In your controller do:
$this->view->value = $value;
and in the view you can get it by doing:
$this->value;
Upvotes: 1
Reputation: 81
In your controller, just pass the value to:
$this->view->yourVariable = $yourValue;
In your view, you can access the value like this:
var_dump($this->yourVariable); /* you'll get $yourValue */
Bring to your code:
$getRows = $this->MgGeneral->select();
foreach($getRows as $value) {
$this->view->value[] = $value;
};
Upvotes: 2