• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
model not loading :(

Hi everyone.

I'm having a problem getting a model to load. I'm getting this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: User::$load
Filename: controllers/user.php
Line Number: 6

Fatal error: Call to a member function model() on a non-object in C:\dev\xampplite\htdocs\ci\system\application\controllers\user.php on line 6

And here is my Controller
class User extends Controller {
    function user()
Any idea's on why I might be getting this error?

Any idea

Well, it looks like I can't load a model within the constructor.

Is there anyway to have a callback like "beforeFilter" in cakePhp?

Thanks again.

I don't know if you just left it out for brevity, or if you left it out of the actual code, but you need a constructor function that calls the contructor for the "Controller" class - or the global classes won't get attached, eg:

function User()

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.