Jump to content

[solved] $page->find does not work


nabo
 Share

Recommended Posts

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

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()

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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...