Reputation: 1
I'm using Zend_Navigation' reading fron xml. I want to add to the menu created from it an additional parameter (got it from the request for the first page).
e.g if the first page is mysite.com/pages/page1?Id=42 then clicking on the menu would add the "?Id=42" to each link.
Upvotes: 0
Views: 457
Reputation: 1774
Easiest way to do this is by extending the Zend_Controller_Action_Helper_Url
class, and adding the query string to the parent::url()
result. Than, you need to inject your url helper into the mvc page, by calling Zend_Navigation_Page_Mvc::setUrlHelper($yourUrlHelper)
.
Example of a query string supported url helper:
class My_Helper_Url extends Zend_Controller_Action_Helper_Url
{
public function url($urlOptions = array(), $name = null, $reset = false, $encode = true)
{
$queryString = $this->getRequest()->getServer('QUERY_STRING');
return parent::url($urlOptions, $name, $reset, $encode) .
($queryString ? '?' . $queryString : '');
}
}
Upvotes: 0