Error while replicating Blogmodel example in tutorial

Newbie here (first day with CodeIgniter - I'm diggin it!)

CodeIgniter 1.7.0 (website says works with PHP5)
PHP5 - PHP 5.2.6-2ubuntu4 with Suhosin-Patch (cli)
Apache/2.2.9 (Ubuntu)
Ubuntu 8.10 64bit

Problem is:

I am trying to load a model and am getting an error emanating from Loader.php.

Here is the error (note that it includes the model contents so the file *is* being found):

class Blogmodel extends Model { function _construct() { // Call the Model constructor parent::Model(); } }
Fatal error: Class 'Blogmodel' not found in /var/www/system/libraries/Loader.php on line 184

I *think* that the class/function/file naming is correct:

Model location and name:

From my controller:

Very simple Model contents:
class Blogmodel extends Model {

// (doesn't work with Blogmodel() constructor either)
function _construct()
// Call the Model constructor


Any ideas? Based on the excellent tutorials I have found, this should all be working.


Couple of things:

A constructor in php5 is __construct() (double underscore)

I don't remember if this will specifically matter but most models are table_model.php, so it'd be Blog_model.php rather than Blogmodel.php - this also means the class itself will be called Blog_model and when you go to load it, you'd be loading blog_model.

I got it. Doy.

I was missing the opening and closing PHP tags on the model page. Like I said - newbie.

Thanks for the help.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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