Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-26-2008, 08:47 PM
Junior Member
 
Join Date: Sep 2008
Posts: 2
Default same code for whole module

hey, i am using the modular structure and want to use it for the navigation. depending on which module is loaded, i want to change the navigation.

as i noticed that there is nothing like init() in controllers, i tried expanding zend_controller_module_abstract - but now i dont know how to interact with the view-object.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-03-2008, 02:06 PM
Junior Member
 
Join Date: Oct 2008
Posts: 6
Default

Please refer to Zend Framework Documentation. It says that there is a init() method in Zend_Controller_Action, which you can extend and its called after class constructor.

View object could be refered by $this->view property inside Zend_Controller_Action
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-06-2008, 03:02 AM
Member
 
Join Date: Jul 2008
Posts: 40
Default

You are on the right track with the init() function, and also right that there isn't one at the Module level. My solution would be to create a parent for all the controllers in your module, something like (where you put this class, and what you call it would depend on your module layout and if you care about autoload working or not)
Code:
abstract class MyModule_Controller_Abstract extends Zend_Controller_Action {
    public function init() {
        // do stuff
        parent::init();
    }
}
Then have all your controller in the module extend that, instead of extending Zend_Controller_Action directly.
__________________
Brenton Alker
Brisbane, Australia

http://blog.tekerson.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-06-2008, 04:32 AM
Senior Member
 
Join Date: Jun 2008
Location: Florida
Posts: 108
Default

I use a controller plugin that handles creating the navigation based on the module requested at preDispatch().
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:03 AM.