jploch Posted September 12, 2023 Share Posted September 12, 2023 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 More sharing options...
monollonom Posted September 12, 2023 Share Posted September 12, 2023 There wasn’t so much nesting in my case but I did have an issue I resolved using $pages->parents()->rebuildAll(). Maybe try this first? Otherwise I think you’d need to be more specific regarding your setup. 1 1 Link to comment Share on other sites More sharing options...
jploch Posted September 13, 2023 Author Share Posted September 13, 2023 @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. 1 Link to comment Share on other sites More sharing options...
monollonom Posted September 13, 2023 Share Posted September 13, 2023 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 More sharing options...
jploch Posted September 13, 2023 Author Share Posted September 13, 2023 @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 More sharing options...
jploch Posted September 13, 2023 Author Share Posted September 13, 2023 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now