e0f Posted June 28, 2019 Share Posted June 28, 2019 Hi all guys, I have pages son of a Page, all with same template. In this template I have so many fields. I want to check if there are pages with the same value of 1 of this 3 fields (a, b, c) and if yes delete one of this. The main intent is to remove all duplicates pages checking by fields. Anyone can suggest me a way? Thanks! Link to comment Share on other sites More sharing options...
EyeDentify Posted July 4, 2019 Share Posted July 4, 2019 <?PHP /* single out with selectors the pages you want to target */ $pageArray = $pages->findMany('template=name_of_template, field_name=value); /* iterate through the selected pages and do something to each of them */ foreach($pageArray AS $key => $myPage) { /* Do something with the page */ } ?> Also check out the documentation for Selectors. They are very powerfull and usefull.https://processwire.com/docs/selectors/ Also check out the API docs for $pagehttps://processwire.com/api/ref/page/ And $pageshttps://processwire.com/api/ref/pages/ The API docs are my first stop when i am trying to figure out to do something in PW. Good luck. 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