开发者

Zend Framework: How can i pass values to layout.phtml?

I can pass value from controller to view with this =>

$this->view->objvalue = $value;

But how can i pass value to layout.phtml ?

I want to have a link to edit table. So i have to make the link with 'id'=>$getvaluefromsomewhere->id. How can i do this开发者_如何学C in zend framework ?

Where would i put this file (My_Layout_Plugin.php) ?

class My_Layout_Plugin extends Zend_Controller_Plugin_Abstract
{
   public function preDispatch(Zend_Controller_Request_Abstract $request)
   {
      $layout = Zend_Layout::getMvcInstance();
      $view = $layout->getView();

      $view->whatever = 'foo';
   }
}

Sending variables to the layout in Zend Framework


put it in library/My/Layout/Plugin.php and add this in application.ini

resources.frontController.plugins.layout = "My_Layout_Plugin"

See here Zend framework 1.8 recommended way to register a plugin?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜