[eluser]a&w[/eluser]
Should I only use the module controller as an accessor to get access to any module utilities?
I was playing around some more, I thought I might be able to load a helper from
another module so I did the following:
Code:
function test()
{
//load a module helper at: someModule/helpers/someHelper.php
$helper = modules::load('someModule', 'helpers/');
}
Works good, except modules::load() apparently wants to register it as a class, which a helper is not.
So then I was looking for other ways to load it. I thought maybe load_file(), but it doesn't look like that will work without a 'path'; it doesn't seem to use modules::find() like modules::load() does. If modules::load() did not try to register the helper class (there is none) I think it would have worked fine.
I also tried this with a model:
Code:
function test()
{
//Attempt 1.
//load a module model at: someModule/models/someModule.php
$model = modules::load('someModule', models/');
//it found the model, but doesn't reload it because someModule was
//already registered (same name as controller already loaded)
//Attempt 2.
//so then try to change model filename so same class name isn't loaded:
//load a module model at: someModule/models/someModule_model.php
$model = modules::load('someModule/someModule_model', models/');
/*
it found the model again, but someModule/models/someModule_model.php
has this:
class someModule extends Model
{
and I get an error: Class 'Model' not found
*/
}
So Attempt 1 and 2 both find there way into the model.
Attempt 1 fails because the class name is already loaded and won't reload.
Attempt 2 fails because it doesn't know where the base class is.