开发者

How do i pass the params to the zend_navigation which references the other page

开发者 https://www.devze.com 2023-01-13 17:01 出处:网络
$pages = array( array( \'label\'=> \'Search\', 开发者_如何转开发\'title\'=> \'Please Search\',
$pages = array(
       array(
          'label'    => 'Search',
          开发者_如何转开发'title'    => 'Please Search',
          'uri'      => 'Search.php',
          'params'   => array('stcode'=>$stcode)
        ));

now the pages array will be passed to the zend_naviagtion

 $container = new Zend_Navigation($pages);
 $view->getHelper('navigation')->setContainer($container);

I have a couple of items in the pages array which will help me displaying the menu when the menu is generated when i click on that search page and it is taking me to the index.php as the code is written if stcode is not present then it will redirect to index.php .Now my problem is how do i pass the stcode to that page


Do you mean doing it via the ZF Request Object, like so:

$this->getRequest()->setParam("stcode", $the_value);

Which can then be accessed like so

$this->getRequest()->getParam("stcode");

// You can also pass an optional default value
$this->getRequest()->getParam("stcode", "wibble");

Or like so

// This has no default value and may return an error depending on your configuration
$this->getRequest()->stcode;
0

精彩评论

暂无评论...
验证码 换一张
取 消