2

Is there a method in the PageList object or somewhere else in concrete5 to get multiple pages back using an array of PageIDs/ciDs? Something like:

Page::getByIDs( array(23,343,44,334,6) );
fregas
  • 3,192
  • 3
  • 25
  • 41

1 Answers1

4

So I figured it out. I think this is the first time I answered my own question. Yay me!

Loader::model('page_list');
$pl = new PageList();
$pl->filter('p1.cID', array(1,2,65,69,70), '=');
return $pl->get();

The p1.cID is part of the SQL query Concrete is generating. Its the alias and column name for page.cid. The array is just the array of pageIDs you want to find. "=" is the operator (not IN which is what I thought it would be.)

It helps to read the documentation:

http://www.concrete5.org/documentation/developers/pages/searching-and-filtering

fregas
  • 3,192
  • 3
  • 25
  • 41
  • 2
    This is good to know, thanks for sharing!. But it doesn't help to read the documentation in this case because the documentation doesn't mention being able to pass in an array! – Jordan Lev Mar 26 '13 at 16:30
  • well thats true. I just did not originally see the "filter" method. The docs are pretty light on specifics. I had to dig into the source code to see that the array() would work with "=". I think "IN" still works too. Also, can you upvote me. :) – fregas Mar 26 '13 at 18:30