-1

I used the code below to get the object's property _items:protected, but no luck.

$obj = JSite::getMenu();
print_r($obj->_items:protected);

Object output

JMenuSite Object
(
    [_items:protected] => Array
        (
            [101] => stdClass Object
                (
                    [id] => 101
                    [menutype] => mainmenu

Anyone know what wrong with my code? Thanks.

Charles Yeung
  • 38,347
  • 30
  • 90
  • 130

1 Answers1

-1

You are trying to access a protected property from outside the class. A protected property can only be accessed from within the class itself or classes that inherit from that class.

Read up on OOP access modifiers.

Flosculus
  • 6,880
  • 3
  • 18
  • 42