2009-11-03

Kohana modules hack

When adding modules to kohana, most oftenly you need to add that module to the config file to have it loaded. Now I find this mostly an unnecessary hassle. (Its useful when sharing module path between applications, though).

However, just comment out the module settings, replacing it with this code snippet:

$config['modules'] = array();
foreach (scandir(MODPATH) as $folder) {
if ($folder != '.' && $folder != '..') {
$config['modules'][] = MODPATH . $folder;
}
}

That'll load all your modules automatically. :)

Hashes: #kohana #php

No comments:

Post a Comment