How can I access url variable from zend view script instead of controller level?
Example: http://domain.local/user/edit/id/23 controller = user action = edit id = 23
From controller I can easily get a value of the开发者_C百科 request variable "id" by writing $id = $this->_getParam('id');
But I want to get it from the view script (user/edit.phtml) directly. How is this possible?
in your view type
Zend_Controller_Front::getInstance()->getRequest()->getParam('id', null);
You could pass it from the controller to the view:-
In your controller:-
$this->view->id = $this->_getParam('id');
Then in your view it is available with:-
$this->id;
精彩评论