Saturday, September 6, 2008

CodeIgniter: Model loading and non object error

I was playing around with CI today and created a user folder in the model folder. Inside the user folder I have a Loginmodel.php file with the Loginmodel php class inside. I load the model with $this->load->model('loginmodel'); but then when I want to call a method on the Loginmodel object I get the following.

Fatal error: Call to a member function user_login() on a non-object in /home/username/public_html/example.com/public/ci/application/controllers/user/login.php on line 20

To fix this I specified the object name upon load, and I used the class name.

$this->load->model('loginmodel','Loginmodel');

This fixed all the issues, however it should have worked the first way. Any idea why it didnt?

Thursday, September 4, 2008

Xcache Simple Test

On a simple install of CodeIgniter I tested the "Page Rendered" time as reported by Codeigniter with and without Xcache. My setup is Ubuntu 8.04, nginx 5.33, mysql 5, php5. Without Xcache the page rendered in ~.05 seconds and with Xcache the page rendered in ~.001 seconds. I will post more once I have a larger code base to test on. 

Wednesday, September 3, 2008

CodeIgniter Textmate Bundle

If you plan on working with the CodeIgniter framework using Textmate this plugin is worth a look. So far it has proved very useful, be sure to check it out.

CodeIgniter Textmate Bundle