CodeIgniter Forums
Cryptical error message: Undefined property: CI_Loader::$base - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Cryptical error message: Undefined property: CI_Loader::$base (/thread-12309.html)



Cryptical error message: Undefined property: CI_Loader::$base - El Forum - 10-14-2008

[eluser]daveario[/eluser]
Hey there,

I know there are a few topics about “Undefined property: CI_Loader::$base” but none of them can solve my problem.

I wrote a module called “Basement“.
Code:
<?php

if (!defined('BASEPATH')) exit('No direct script access allowed');

class Basement extends Model {

function Basement()
{
    parent::Model();
}

function page_title()
{
    $query = $this->db->query(page_query($this->uri->segment(3)));
    if($query->result() > 0) {
        $row = $query->row();
        echo $row->title;
    }
}

}

?>

In my “header” view, loaded by the “page” view, I loaded the model.
Code:
$this->load->model('basement', 'base', 'TRUE');

Now I want to access the functions.
Code:
<?=$this->base->page_title()?>

but it won't work, I get the following error message:
$this->load->model('basement', 'base', 'TRUE');
Quote:Undefined property: CI_Loader::$base

Can someone help me please? I really don't know why it doesn't work.


Cryptical error message: Undefined property: CI_Loader::$base - El Forum - 10-14-2008

[eluser]daveario[/eluser]
Hah, solved it, I just loaded the Model in the Controller, not the view.
Sorry for the trouble!

David