-1

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 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

Community
  • 1
  • 1
cola
  • 12,198
  • 36
  • 105
  • 165
  • 2
    See this question http://stackoverflow.com/questions/1537700/sending-variables-to-the-layout-in-zend-framework – Claudio Aug 28 '11 at 13:46
  • I edited that original question. Where would i put that plugin file ? – cola Aug 28 '11 at 14:42

1 Answers1

2

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?

Community
  • 1
  • 1
emeraldhieu
  • 9,380
  • 19
  • 81
  • 139