Note that there are some explanatory texts on larger screens.

plurals
  1. POStart execution from indexAction() in IndexController in ZEND Framework
    text
    copied!<p>In indexAction() method of IndexController I have called the method of model which returns the list of employees(employeeList) from database.And then add this this employeeList to $view and then call $view->render('index.phtml') and index .phtml shows the employeeList.The code is ad follows:</p> <p>IndexController.php</p> <pre><code>&lt;?php require_once('../Zend/Controller/Action.php'); require_once('../models/HRModel.php'); require_once('../Zend/View.php'); class IndexController extends Zend_Controller_Action { protected $hrModel; public function init() { $this-&gt;hrModel = new Application_Model_HRModel(); } public function indexAction() { $view = new Zend_View(array('scriptPath' =&gt;'../views')); $view-&gt;employeeList = $this-&gt;hrModel-&gt;queryAllEmployees(); echo $view-&gt;render('index.phtml'); } } </code></pre> <p>Application_model_HRModel.php</p> <pre><code>&lt;?php require_once('Zend/Db.php'); require_once('Zend/Config/Ini.php'); class Application_Model_HRModel { protected $db=null; public function queryAllEmployees() { return $this-&gt;db-&gt;fetchAssoc("select comment from guestbook"); } </code></pre> <p>}</p> <p>index.phtml</p> <p> <pre><code>foreach ($this-&gt;employeeList as $emp): extract($emp); echo '$EMPLOYEE_ID'; echo $comment; endforeach </code></pre> <p>Now I want to start the execution from indexAction() method.But how to do this?What should be the url to be entered in browser?In request parameter the controller will be IndexController and action will be indexAction.So Kindly help me in resolving this issue.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload