The error is from this:
$page->adminNavi[$i]->active
Either $page
isn't set or an object, or adminNavi
isn't an array, or adminNavi[$i]
doesn't exist, or isn't a stdClass
.
Debug it!
var_dump($page->adminNavi); exit;
With luck, you'll get an array. In which case var dump array key $i
and see what's in there.
UPDATE: okay so the var dump returns this
array(1) { [0]=> object(stdClass)#2 (1) { ["active"]=> bool(false) } }
How many times does $i
change? If it's anything other than 0
, that array key will not exist, but you immediately refer to it like it does, and since you treat it like a stdClass
, it creates one on the fly but generates the warning.
To sum up, make sure $i
exists by counting the array! If $i
is set from a loop, then something like this:
for ($i = 0; $i <= count($page->adminNavi): $i++) {
// your code
}