2010-08-31 103 views
0
$pages = array(
     array(
      'label' => 'Search', 
      'title' => 'Please Search', 
      'uri'  => 'Search.php', 
      'params' => array('stcode'=>$stcode) 
     )); 

現在的頁面數組將被傳遞給zend_naviagtion的zend_navigation我如何通過PARAMS到它引用其他頁面

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

我有一對夫婦的頁面數組中的項,這將幫助我顯示菜單 當我點擊該搜索頁面時產生菜單,並且 它將我帶到index.php,因爲如果stcode不存在,那麼它會被寫入,然後 它將重定向到index.php。現在我的問題是我如何將stcode傳遞給該頁面

+0

我有遇到問題後出現問題。這是否正確 - 如果在訪問Search.php時沒有出現「stcode」,用戶將被重定向到index.php?什麼是問題,你看起來似乎無法將'stcode'值發送給? – 2010-08-31 15:07:10

+0

@jakenoble:如果沒有「stcode」目前比它重定向到index.php.but但如果我通過這種方式 也例如它將工作search.php?stcode =。「$ stcode」 但我的問題如何我是否通過Stcode我不想以上述方式通過。 我想通過它參數 – Someone 2010-08-31 17:12:30

回答

1

你的意思是通過ZF請求對象做起來,就像這樣:

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

然後可以像這樣

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

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

訪問,或者像這樣

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