Advanved Modules - Model problems
I am trying to follow the advanced modules guide to create a module for my CMS project but am struggling to get a model to load.
Controller Code
function index()
{
$this->_validate_user('offers');
$this->load->module_config(OFFERS_FOLDER, 'offers');
$offers_config = $this->config->item('offers');
$this->load->module_model('offers','offers');
$vars['offers'] = $this->offers->getAllOffers();
$this->_render('offers_admin',$vars);
}
The error I get is
Message: Undefined property: Offers::$fuel_auth
Filename: libraries/Fuel_base_controller.php
Line Number: 31
Anyone know what I am doing wrong?
Comments
$this->fuel_auth = $this->load->module_library('FUEL_FOLDER');
It got further but then stopped in the assest_helper with a problem on jspath....
I may well be doing something stupid wrong here but it is incredibly frustrating trying to get an advanced module to work.... May have to abandon the FUELCMS and look for an alternative.
I have added an echo to the fuel_base_controller constructor and found that the constructor is firing a second time when I call
$this->load->module_model('offers','offers');
The second time it is loading is causing it to fail...
1. What is the path and name of your controller?
2. Can you paste in the whole code or at least up to the index method?
2. Is this with 0.93 or the 1.0 beta version
https://github.com/daylightstudio/FUEL-CMS/tree/1.0
I am using 0.93 at the moment.
The path is fuel/modules/offers/controllers
The whole controller is
<?php
require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');
class Offers extends Fuel_base_controller {
public $view_location = 'offers';
public $model_name = 'offers';
function __construct()
{
parent::__construct(TRUE);
$this->_validate_user('tools/offers');
}
function index()
{
echo('Fred');
$this->load->module_model(OFFERS_FOLDER,'offers');
echo(' is dead!');
// $vars['offers'] = $this->offers->getAllOffers();
// $this->_render('offers_admin',$vars);
}
}