Spyros Posted April 3, 2020 Posted April 3, 2020 Hello I'm having a strange issue with the $page->find(), for some reason I'm missing some of the pages from the results. I found then that I was missing all the pages with the same "PAGE NAME". Is it a bug or am I missing something? PS If I change the "PAGE NAME" of one of the missing ones then I'm retrieving the page without any problem. Thank you
huseyin Posted April 3, 2020 Posted April 3, 2020 You can't have pages with same name. May be it is the title. Could you share your whole find code and the for each code to list the results
Spyros Posted April 3, 2020 Author Posted April 3, 2020 Hello Huseyin I have many pages which share the same "PAGE NAME", but there are not on the same level. For example: Level1/PAGE_NAME_EXAMPLE Level1/level2/PAGE_NAME_EXAMPLE Level1/level2/level3/PAGE_NAME_EXAMPLE $pages->find('template=templateNAME')->pageQueryJson($query); So for example if we had to retrieve the above example of pages I would get only one of those. I'm not sure if it gets the first or the last match. If I change the "PAGE NAME" to something unique then I'm getting the page. Thank you Spyros
louisstephens Posted April 3, 2020 Posted April 3, 2020 I assume based on your code above, that templateName is being used by all Page_Name_Examples?
Robin S Posted April 3, 2020 Posted April 3, 2020 3 hours ago, Spyros said: I have many pages which share the same "PAGE NAME", but there are not on the same level. It works fine here: 3 hours ago, Spyros said: $pages->find('template=templateNAME')->pageQueryJson($query); pageQueryJson() is not a core method. If that method is the cause of your issue best to ask in the module's support thread. 2
Spyros Posted April 7, 2020 Author Posted April 7, 2020 Thank you Robin for pointing me in to the right direction So as you said the issue was from the Page Query Boss module. Actually it was not an issue of the plugin but I had to change the configuration of the output. The default output format is an array with the "PAGE NAME" as keys. Instead I used the ids as keys. $modules = wire('modules'); $modules->get('PageQueryBoss')->defaults['index-id'] = ['Page']; $pages->find('template=templateNAME')->pageQueryJson($query); 1
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