Tip: Obtaining Request Parameters in Zend_View
I found it virtually impossible to obtain GET or POST request parameters in Zend_View without resorting to accessing the $_GET or $_POST variables. Directly accessing these variables within Zend_View is bad practice so it's been suppressed on purpose to keep processing where it should be - within the Controller. However it is possible to get hold of these variables properly and that is to pass them from the Controller.
Example. You have a query string that looks like this ?keyword=test and want to show it in your view, here's what to do:
MyController.php
public function indexAction() { $this->view->request = $this->getRequest(); }
my-controller/index.phtml
The keyword is <?= $this->request->keyword ?>
Thanks!
Similar Posts
- None Found


Recent Comments