Codeigniter Undefined Property, or how will my controller stop worrying and learn to love the model
Had a closer look and the answer is very simple: Try changing this line:
public function __contruct(){
to this:
public function __construct(){
;)
i found the problem. It was in the routes.php. These lines
$route['articles/(:any)'] = 'articles/view/$1';$route['articles'] = 'articles';
I changed to this...
$route['articles/(:any)'] = 'Articles/view/$1';$route['articles'] = 'Articles';
And now I get a 404 because my database is empty, as expected. Still don't know why theses rules...
$route['default_controller'] = 'pages/view';$route['(:any)'] = 'pages/view/$1'
from the first tutorial work without "pages"being capitalized. The world will never know...
First, regarding the comments: print_r($this);
is a very bad idea, as it will only confuse you. $this
contains almost none of the ci stuff. What you are looking for is print_r(get_instance());
Regarding your problem: ci lowercases member names. Change your line to this and your are good to go:
$this->articles_model->get_article();