|
|||
|
Hic hic,
I have a problem with function init() in my IndexAction class: PHP Code:
__________________
Nắng sớm nhớ cha nợ cha một sự nghiệp Chiều ta thương mẹ nợ mẹ một nàng dâu ---------------------------- Diễn đàn Nghệ An - Hà Tĩnh: http://nghe-online.org/forum |
|
|||
|
user varible $disactivateInit = false;
in init function function init() { $disable = $_SESSION['disactivateInit']; if ( $disable == true )return ; $response = $this->getResponse(); $response -> insert('footer', $this->view->render('footer.phtml')); } in showCatAction : function showCatAction() { // my code $_SESSION['disactivateInit'] =true ; } |
|
|||
|
A little foundational first....
init() is called by Zend_Controller_Action from the constructor method so you can add functionalities to the initialization of your controller class (done so you don't have to overload the parent __construct() magic method and have to do a parent::__construct() call). So, init() should be treated as if it was actually __construct(). For what you are trying to achieve, I would suggest that you do not assign the footer in the init() method. If you want to have the footer included by default, and be able to toggle it off if necessary (such as with the showCatAction() method), I would suggest you assign you footer placeholder a bit later on in the workflow, such as in postDispatch(). PHP Code:
Steve |
|
|||
|
Thank you very much!
![]()
__________________
Nắng sớm nhớ cha nợ cha một sự nghiệp Chiều ta thương mẹ nợ mẹ một nàng dâu ---------------------------- Diễn đàn Nghệ An - Hà Tĩnh: http://nghe-online.org/forum |
![]() |
| Thread Tools | |
| Display Modes | |
|
|