Reputation: 98
i want to create a module for my running application. I chose module, so that it can be added optionally to the application.
I want to create the following. When the module is installed (module subfolder is placed in /application/modules/) i want to add a new button/function to my application.
I want to check for this installed module in a controller action.
Is there a way to do this?
Regards, Max
Upvotes: 1
Views: 780
Reputation: 2173
In order to let the application generate the new menu, what I like to do is to create a global var that holds the menu. This way, in the new module Bootstrap, I can add items to the menu. The code that I use is rather long so I will not post it here but you can email me if you want it.
Upvotes: 0
Reputation: 1692
This should help:
$modules = Zend_Controller_Front::getInstance()->getControllerDirectory();
The modules are then given by the keys of the array that is returned:
array(
'default' => '../application/controllers',
'blog' => '../modules/blog/controllers',
'news' => '../modules/news/controllers',
)
You can then perform the check in your action:
if (array_key_exists('myModule', $modules)) {
// do something
}
Upvotes: 2