Welcome Guest, Not a member yet? Register   Sign In
"Undefined property: CI_Loader"
#1

[eluser]Dauntless[/eluser]
Hi,

I've already built an entire site with CI, but for some reason I'm stuck at the start with my next site...

What I have now:
Code:
<?php

class Main extends Controller {

    function Main()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $data = array();
        $data["toLoad"] = "main";
        $data["active"] = 1;
        $this->load->view('mainView', $data);
    }
}

?>
And my view:
Code:
<?php $this->load->view("includes/header") ?>
    <!-- ... -->
<?php $this->load->view("includes/footer") ?>
And in my header I just have:
Code:
<?=$this->active ?>
Now I get an error saying
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$active

Filename: includes/header.php

Line Number: 1
Why doesn't he find my $active ?

I know it's probably something stupid, but I just can't figure it out :S

Greets!
#2

[eluser]wiredesignz[/eluser]
The error is telling you that $active is not a class variable of the view loader.

Try just $active instead of $this->active
#3

[eluser]Dauntless[/eluser]
That's weird, I thought I already tried that :S.

It seems to work now, so thank you for your reply & sorry for wasting your time Wink




Theme © iAndrew 2016 - Forum software by © MyBB