Welcome Guest, Not a member yet? Register   Sign In
Matchbox model loading...
#1

[eluser]eurotrash[/eluser]
I have Matchbox 0.9.4 and CI 1.6.1 working on my localhost. When I try to load a model I get the following error:
Fatal error: Call to a member function model() on a non-object in /Applications/xampp/xamppfiles/htdocs/cim/system/application/modules/articles/controllers/articles.php on line 11

The controllers are working correctly so I am certain that I have installed correctly.

Obviously Matchbox is looking in the wrong directory for the model. How do I load a model in the controller from the application directory using matchbox? I am loading the model by calling
Code:
$this->load->model("article");

I'm pretty sure sure that I need to tweak the $this->load statement in order for it work.

Thanks
#2

[eluser]zdknudsen[/eluser]
Can I see your controller?
#3

[eluser]eurotrash[/eluser]
Code:
<?php

class Users extends Controller {

    function Users()
    {
        parent::Controller();    
    }
    
    function index()
    {
         $this->load->module_model('u','user');
        //$this->load->Model("User");
        echo("index");
        
    
    }
}
?>
#4

[eluser]zdknudsen[/eluser]
A fresh install of Matchbox and CodeIgniter, with your controller works fine for me (except for changing the first argument in $this->load->module_model from 'u' to 'users', but that's just because I tested it on a module called 'users'. Remember that the first argument is the module, and the second is the model).

Are you sure you have removed previous versions of Matchbox (or Modular Separation)?
#5

[eluser]eurotrash[/eluser]
It's clean install of matchbox and C.I. 1.6.1
#6

[eluser]zdknudsen[/eluser]
Well I ran CI 1.6.2, try updating to that, although I doubt that is the cause. I've zipped my simple working app with your controller so you can see how I did it.

http://www.filepanda.com/file/zxpikiwovd8a/
#7

[eluser]eurotrash[/eluser]
Figured it out

I had
Code:
parent::Controller();

instead of
Code:
parent::Model();
in my model

Psyched to start using Matchbox on my next project.

Thank
#8

[eluser]zdknudsen[/eluser]
You're welcome. I hope you'll like it. I know I do ;-)




Theme © iAndrew 2016 - Forum software by © MyBB