ian,
that's a cool idea, but i guess my question is, how do i tell what module/controller/action i'm working with when i'm in the bootstrap index.php file? what does the colon in the config section header do? I couldn't find anything about it in the parse_ini_file php.net page.
thanks for the response
- hoopes

Ian Warner wrote:

Hi

I use the config file, place this config array in config.ini.php or whatever you use, call it DEFAULT

[default]
plugins.Auth        = true
plugins.Translation = true

Then for each project, controller or whatever delimiter you use, ie for admin you can dedide to remove a plugin, ie below the authn plugin is removed from the list

[admin : default]
plugins.Auth  = false

Then you can iterate through the plugins:

        // Loop through the required plugins needed from the config.
        foreach ($config->plugins as $k => $v) {

            if (!empty($v)) {
                $plugins[$k] = $v;
            }
        }

        if (!empty($plugins)) {
            return $plugins;
        } else {
            return false;
        }

Hope that helps

I do the same for Modules also.

Ian

Hoopes wrote:
Hey,
I'm looking for a way to register plugins for the front controller based on what module (or controller) i'm being routed to. Basically, i'd like a subset of controllers throughout my app to all have certain data before they get started, without having to put the logic in preDispatch of every controller that needs it. getRequest() on the front controller doesn't get me anything.

I guess what i'm asking is, is there any way to determine what module/controller/action was called in the bootstrap index.php file? or another way to selectively register frontController plugins?

thanks
- hoopes

Reply via email to