nabo Posted March 30, 2021 Share Posted March 30, 2021 Hello I have a strange problem with $page->find The problem is that it's not work for a particular template. I correctly get the starting $page but these kind of selectors don't work $page->find("template=my-template") $pages->find("has_parent=xxx,template=my-template") but these work $page->find("template=another-template") $pages->find("template=my-template") I tried also with include=all in the selector. The strage thing is that I repeat the same procedure with another starting parent $page the system works perfectly. Any ideas? Link to comment Share on other sites More sharing options...
Robin S Posted March 30, 2021 Share Posted March 30, 2021 Just checking: you know for certain that you have published, unhidden pages that use template "my-template" as descendants of $page (i.e. you can see them in the page tree) but they are not returned with either: $results = $page->find("template=my-template"); or $results = $pages->find("has_parent=$page, template=my-template"); (both of these are effectively the same thing) If that's the case it's possible that something has gotten messed up in the pages_parents database table. In PW 3.0.156 or newer you can rebuild the pages_parents table by executing the following in the Tracy console or in a template file: $pages->parents()->rebuildAll(); See method PagesParents::rebuildAll() 1 Link to comment Share on other sites More sharing options...
nabo Posted March 31, 2021 Author Share Posted March 31, 2021 Thanks @Robin S. I will try soon and let you know! (unfortunately the PW installed is 3.0.123 and I need some time to update it) Link to comment Share on other sites More sharing options...
nabo Posted April 8, 2021 Author Share Posted April 8, 2021 On 3/30/2021 at 10:33 PM, Robin S said: $pages->parents()->rebuildAll(); See method PagesParents::rebuildAll() Thanks @Robin S this command solved the problem! Thank you again ? 1 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