Page_list show pages by multiple ID's

Permalink
I am using page_list
$bt = BlockType::getByHandle('page_list');

Can I show child pages of 2 and more pages ID
$bt->controller->cParentID = '146','147','152';

Because as it is now doesn't work

sergio11ofpp
 
brianvandelden replied on at Permalink Reply
brianvandelden
No. Not with the default block. You can better use a PageList.

$pl new PageList();
$pl->filterByCollectionTypeHandle("YOUR HANDLE");
$pl->filterByParentID(array(PAGEID1,PAGEID2,PAGEID3));
$results = $pl->getPage();


Also see:
http://www.concrete5.org/documentation/developers/pages/searching-a...
sergio11ofpp replied on at Permalink Reply
sergio11ofpp
Loader::model('page_list');
      $pl = new PageList();
      $pl->filterByParentID(array(146,147,152));
      $pages = $pl->getPage();

Doesnt show me anything(((
brianvandelden replied on at Permalink Reply
brianvandelden
Try this:

Loader::model('page_list');
        $pl = new PageList();
      $ids = array(ID1, ID2, ID3);
      $db = Loader::db();
      if (is_array($ids)) {
         for ($i = 0; $i < count($ids); $i++) {
            if ($i > 0) {
               $and.= ' OR ';
            }
            $and .= "p1.cParentID = " . $db->quote($cParentID[$i]);
         $this->filter(false, "({$and})");
         }
}
        $pages = $pl->getPage();
shahroq replied on at Permalink Reply
shahroq
$bt->filter(false, "(p1.cParentID IN (146,147,152))");