Mackski Posted February 27, 2017 Share Posted February 27, 2017 I have many pages with multiple Page fieldtypes. What I'm looking at doing is caching the related pages, however I cannot obtain ID references via $page->getArray(). I only get [title] returned. Is there a way to return Page typefield field ID references to other pages without hitting the DB? Link to comment Share on other sites More sharing options...
kongondo Posted February 27, 2017 Share Posted February 27, 2017 In ProcessWire 3.x (I think only 3?) you can use implode like so: $pageIDsString = $yourPageArray->implode('|', 'id'); //echo $pageIDsString;// returns 1234|2345|8976 etc.. You can choose your delimiter and the property to implode by. There's other interesting methods here. 2 Link to comment Share on other sites More sharing options...
kixe Posted February 27, 2017 Share Posted February 27, 2017 You can use $page->getIterator(); instead of $page->getArray(); 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