Contoller iscalled MaintainusersController.php
View is called maintainusers/listusers.phtml
How do I push values from controller to view.
foreach ($users as $value){
/// do something here
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You push values to the view from the controller by creating variables on the $this->view object, which is a member of Zend_Controller_Action. The variables you create on $this->view are accessible in the view script from $this, since the view object is encapsulated within the view script.
For example if you wish to bring the username from the controller to the view, you could this from your action method:
Which you can access from the view script as:
In your example you’re pushing an array of values, which you can store directly on the $view in the action method:
And then iterate over from within the view script: