Welcome Guest, Not a member yet? Register   Sign In
Problem Loading Model
#11

[eluser]tik1[/eluser]
[quote author="TheFuzzy0ne" date="1209176187"][quote author="tik1" date="1209175857"]I get the letters a, b, and c on the screen with an error because the variable $data has not been defined.[/quote]

Do you get anything when you put an echo statement into the model's constructor?[/quote]

No I don't get anything back. I don't see the values of those echo statements in the models constructor on the screen.

I tried both ways of defining the constructor.

Also, I did check to make sure I didn't have any whitespaces outside the php tags as suggested above.
#12

[eluser]TheFuzzy0ne[/eluser]
[quote author="tik1" date="1209176436"][quote author="TheFuzzy0ne" date="1209176187"][quote author="tik1" date="1209175857"]I get the letters a, b, and c on the screen with an error because the variable $data has not been defined.[/quote]

Do you get anything when you put an echo statement into the model's constructor?[/quote]

No I don't get anything back. I don't see the values of those echo statements in the models constructor on the screen.

I tried both ways of defining the constructor.

Also, I did check to make sure I didn't have any whitespaces outside the php tags as suggested above.[/quote]

Sorry, I edited my post as you replied. Please check out my previous post.
#13

[eluser]gtech[/eluser]
have you tried turning on the logging by setting the log_threshold in the config/config.php you may get some clues from there.. you will need to create a logs dir in the system directory if its not already there.

[edit]I copied your code exactly and it worked fine! file names and all, so it must be a config issue. why not download a fresh codeigniter 1.6.1 from the homepage and copy it to a fresh install directory.. then just change the config/config.php file so that base url is correct. copy your controller/model and view into the appropriate dirs and retest?
#14

[eluser]tik1[/eluser]
I did find an error reporting value in the php.ini and turned it on. I now get the following error

Parse error: syntax error, unexpteced '{' in membershipmodel.php on line 2
#15

[eluser]gtech[/eluser]
try creating another model with a simple name by hand so that no rouge characters are inserted, or do a fresh install because I cut and copied your code.. it worked fine on my install!
#16

[eluser]tik1[/eluser]
Thanks for all your help. It turned out to be simpler than I thought. The text editor I was using, TextWrangler in this case, put in some odd character in the model. I saw them once I opened the files in VI. Everything works now.
#17

[eluser]tsan[/eluser]
I get an error when I have a model load command in controller. Controllers and views works, but models not.

My simple model, which is in models directory , filename testmodel.php.
Code:
Class Testmodel extends Model {
    function Testmodel() {
        parent::Model();
    }
}

Then in controller I load it with command $this->load->model('testmodel.php');

Class Testmodel extends Model { function Testmodel() { parent::Model(); } }
Fatal error: Class 'Testmodel' not found in /var/www/ci_test/system/libraries/Loader.php on line 177

For me it looks that CI has found everything as it shows the code in testmodel.php. Still an error Class not found. I tested various ways, different controller, model and upper/lowercase
names , Url config settings in config file but always the same. If I have more functions in model error message shoes it all. I'm using Ubuntu LAMP server. CI version is the latest 1.6.2, I just started using CI.
#18

[eluser]tsan[/eluser]
Well, it should be above $this->load->model(’testmodel’);

This I have used and get an error. If extension .php is on load command, then file not found is given, but that's normal.
#19

[eluser]tsan[/eluser]
Reason was that I didn't have php tags on model. I copy/pasted examples on the User Guide and still model loading didn't work. Tags are shown on User Guide examples for Controller and View, but not for model. Therefore I though they are not needed on model file.




Theme © iAndrew 2016 - Forum software by © MyBB