Sub-pages and isChildOf()

Hi,

I’ve got this folders :

    1_informations 
       1_contact
       2_about
    2_images
       1_item_1
       2_item_2

At http://localhost/images/item_1
$page->isChildOf('informations') is true
page('informations')->isOpen() is false

Something wrong ?
(I just make a navigation with sub-pages link visibles if it’s the same father)

That doesn’t make sense. It should return false in this case, but the method always returns true no matter what you pass to it.

The result of the second statement is correct.

I created an issue on GitHub for the isChildOf() method:

2 Likes

If you need more help, please post your code and what exactly you are trying to achieve.

isOpen() returns true if either the current page is active or a child page.

It’s OK just like to understand the code :slight_smile: