Welcome Guest, Not a member yet? Register   Sign In
load is unknown?

Hi there forums!
I just set up a new site, and I wanted to start from scratch (with CI of course).
I've copied the welcome controller into my own Index controller and created a homepage that should just say 'Welcome!'.
But whenever I try to load the page it gives me this:
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Index::$load

Filename: controllers/index.php

Line Number: 7

It seems it's not properly accessing the load view function, the code looks like this:

I don't see what I did wrong here, it should just be something simple right?

Paste your entire controller's code. I'm guessing you misspelled something.

Do not use reserved words for Controller naming.

Refer: http://ellislab.com/codeigniter/user-gui...names.html

Solving for Facebook's "load-error: unknown" error Spent about the last 20 minutes debugging a mysterious error

Right so the problem was that I forgot the constructor at the beginning of the controller. Simple as that, without the constructor it probably won't know what to do Tongue

Also @wiredesignz you can use index as a controller name, I've done it before and never ran into trouble...

@Firenter, A class constructor is not normally required unless you are carrying out some initiation for the class. PHP5 will automatically run the parent constructor in it's absence.

The reason that your application failed and required an empty __constructor is because the index method is considered to be the constructor if your controller class name is also Index.(prior to PHP5.4)

So the parent constructor was never being called and the Loader was never initialized.

This is why the User Guide makes note of reserved words, to avoid this kind of confusion.
(And possibly with some carry over from PHP4 in some cases)

Thanks for the explanation, learning new things everyday!

Theme © iAndrew 2016 - Forum software by © MyBB