Hi,

I followed the Zend_Layout example at http://akrabat.com/2007/12/11/simple-zend_layout-example/

There was no problem in setting up the layout at all.

Instantiating the response object and accessing its insert method in the init() function of every controller is repetitious. Therefore, I try to push the code in the init() function of the controller to an action helper.

I have an action helper foo. Below is the code in foo.php

<?php

       $frontController = Zend_Controller_Front::getInstance();

       $response = $frontController->getResponse();
$response->insert('sidebar', $view->render('../layouts/region/sidebar.phtml'));
       $response->insert('main', $view->render('menu/main.phtml'));


When I view the page, I get an error
*Fatal error*: Call to a member function insert() on a non-object in *../BV/Controller/Action/Helper/Foo.php* on line *7

*Line 7 in Foo.php is $response->insert('sidebar', $view->render('../layouts/region/sidebar.phtml'));

The error message indicates that I can't access the insert method of response object. Am I allowed to access the insert method of the response object in the action helper? If so, how?

Regards,
--

With warm regards,
Sudheer. S
http://binaryvibes.co.in

Reply via email to