Help with advanced module
Hello,
Following the toturial on advanced module, I am trying to create a module for admin.
I've created all the files, I see the admin toolbar, but when I click on the open orders link I get this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Module::$model_name
Filename: controllers/module.php
Line Number: 79
An Error Was Encountered
Unable to locate the file: .php
My openorders controller begins with:
<?php require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');
class Openorders extends Fuel_base_controller {
public function __construct()
{
parent::__construct();
$this->load->model('admin_model');
}
}
I tried that as well:
<?php require(MODULES_PATH.'/module.php');
class Openorders extends Module {
public function __construct()
{
parent::__construct();
$this->load->model('admin_model');
}
}
Not sure what I am doing wrong, didn't really understand that part in the tutorial:
"3. Create your controller files.
Admin Controllers - Pages that need to be displayed in the admin interface should inherit from the fuel/modules/fuel/libraries/Fuel_base_controller.php OR fuel/modules/fuel/controllers/module.php (which inherits from Fuel_base_controller) and can use the _validate_user(), protected controller method."
and I think the problem might be there.
Can you please help?
Comments
I used to have an openorders simple module but I deleted the line from MY_fuel_modules. Do I need to delete anything anywhere else?
Maybe I should explain what I want:
I need to have a title called Admin on the dashboard, under it I will have two links:
Open Orders
Closed Orders
I have a database table called orders. In the Open Orders I want to display only open orders from this table and of course in the Closed Orders only closed ones.
I have created an advanced module called admin.
It has a config file with this code:
$config['nav']['admin'] = array( 'admin/openorders' => 'Open Orders', 'admin/closedorders' => 'Closed Orders', );
admin_constants file:
define('ADMIN_VERSION', '1.0.0'); define('ADMIN_FOLDER', 'admin'); define('ADMIN_PATH', MODULES_PATH.ADMIN_FOLDER.'/');
admin_routes:
$admin_controllers = array('openorders', 'closedorders'); foreach($admin_controllers as $c) { $route[FUEL_ROUTE.'admin/'.$c] = FUEL_FOLDER.'/module'; $route[FUEL_ROUTE.'admin/'.$c.'/(.*)'] = FUEL_FOLDER.'/module/$1'; }
I have openorders controller.
What do I put in this controller?
Do I start it like this?
<?php require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php'); class Openorders extends Fuel_base_controller { public function __construct() { parent::__construct(); $this->load->model('admin_model'); }
Thanks
// add additional module config parameters here $config['modules']['openorders'] = array(); $config['modules']['closedorders'] = array();
The advanced module still needs to define the simple modules within it.
Now another question, can I create a simple module called openorders when I don't have an openorders table?
Yes the module will need to refference a few tables.
Is there a way I can use the controllers and models I have developped for this in my codeigniter site instead of redeveloping everything?
Where do I find the assets_model?
Merry Christmas