Jump to content

[SOLVED] $pages->find('') is not returning all grandchildren


jploch
 Share

Recommended Posts

Hey folks,

it seem that after a certain level of nesting $pages->find('') is not returning all grandchildren. This seems to be a bug or maybe it is intentional?
Is there another way of getting all the pages no matter how deep they are nested with a selector?

Link to comment
Share on other sites

  • jploch changed the title to $pages->find('') is not returning all grandchildren

@monollonom Nice! If I call $myParentPage->parents()->rebuildAll() before $myParentPage->find('') This seems to fix the issue. Thanks!

The performance seems to be great so far with about a 70-100 pages. Before I was using a recursion function like this as a workaround that would call itself for a number of times. Will investigate further wich version is more performant. 

  • Like 1
Link to comment
Share on other sites

  • jploch changed the title to [SOLVED] $pages->find('') is not returning all grandchildren

FYI you don’t need to call this function everytime. PW is supposed to do this on its own (fill the pages_parents table as you add/move pages), but there may be a bug or what I couldn’t pin down. I’d say whenever you see an issue like, just do a quick function call through TracyDebugger’s PHP console and you’re good to go.

Link to comment
Share on other sites

@monollonom I will only use it in cases, where $pages->find('') is not working as expected. In my case it would not return any pages with a deeper nesting then 5 levels (tested on the latest PW master version 3.0.227). I never run into this issue before so there might be something else going on, or I never had a nested structure that was this deep. Will also test with a new install when I have some time.. If the issue persists, I might open an issue on Github.

Link to comment
Share on other sites

This seems to be related to the fact, that the $pages->find('') call is inside a inputfield module function. Calling it from a template file seems to return all grandchildren even without the rebuildAll() call.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...