webhoes Posted July 28, 2017 Share Posted July 28, 2017 I am trying to get an unique array with this code $voedsel = Array(); $voedsel = $pages->find("template=schildpad, schildpad_caresheet=$page->title")->id; $result = array_unique($voedsel); For array_unique I get the following error in Tracy: PHP Warning: array_unique() expects parameter 1 to be array, object given in... I want to put the unique array in a custom function that makes a list with an image and title. What am I doing wrong? Link to comment Share on other sites More sharing options...
Zeka Posted July 28, 2017 Share Posted July 28, 2017 Hi @webhoes You can do it in several ways $arr = $pages->find()->getArray(); $result = array_unique($arr); or $arr = $pages->find()->unique(); https://processwire.com/api/ref/wirearray/unique/ $pages->find() method returns a filtered PageArray unless an include mode is specified. 3 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