Hi,
Never done anything with modules before but going to start using them in a new site.
I have enabled the config with:
'module_paths' => array(
array(APPPATH.'modules'.DS)
),
I have a module named "store_manager" with a directory structure as follows
-modules
- -store_manager
- - -classes
- - - -controller
- - - - -products.php
- - - -model
- - - - -products.php
- - -config
- - -lang
- - -views
- - - -products
- - - - -dashboard.php
the controller has the following code
<?php
namespace store_manager;
class Controller_Products extends Controller {
public function action_index()
{
$this->output = Model_Products::hello_world();
}
}
The model has this code
<?php
namespace store_manager;
class Model_Products extends Model {
public static function hello_world()
{
return 'hello world!';
}
}
I can't seem to access the module using a URI string.
I would have thought it would be located at http://www.devurl.dev/store_manager but it throws up a 404 generated by the welcome controller. I added a test controller in the same place as the welcome controller and I can access that using http://www.devurl.dev/test.
How do I access the module???
Many thanks in advance
Craig
Cheers for the reply,
It shouldn't matter if its all lowercase should it? either way I have changed the namespace to StoreManager but still nothing works. The config file is fine but nothing form the module is being used. I can litter the controller with errors but all I get is a 404 ??
Sorry. I'm on an iPhone so a long response is hard...
namespace StoreManager in your classes.
devurl.dev/storemanager in your URL.
storemanager is your directory name.
Add the module at runtime.
Fuel::add_module('storemanager');
Cheers for trying to help.
Not having much luck here, used the modules in that github repo but even they throw a 404. I installed the whole repo and it just throws numerous errors.
Got it working but have no idea how. I downloaded a new copy of Fuel, installed it and moved the modules back and everything worked
Not really sure what was the problem.
After I read your post I tried to see what was happening and found out that there were some issues when using CamelCased in the modules. I forked a fix in [this branch] (https://github.com/axelitus/fuel_core/tree/develop "axelitus/fuel_core/branch/develop"). I figured out some issues regarding the Autoloader class. I also fixed the Config class to work well with modules, because there were some issues while saving config files.
Hope this helps.