Sort pagelist by parentID

Permalink
Hi,

I currently have a page list pulling in all the 'featured' pages onto the homepage using the 'is_featured' attribute.

Is there a way of sorting these pages by each page parentID.

My sitemap looks like this:

Cat 1 (id='140')
- page 1
- page 2 (featured)
- page 3

Cat 2 (id='141')
- page 1
- page 2
- page 3 (featured)

Cat 3 (id='142')
- page 1
- page 2 (featured)
- page 3

So id want the 3 featured pages to always by in oder of cat 1, cat 2 cat3 no matter which pages are marked as featured.

Hope this makes sense?

 
magpie replied on at Permalink Reply
by the way this is the pagelist code I'm currently using which simply displays all featured pages of a particlular type.

$pagelist = new PageList();

$pagelist->filterByCollectionTypeID('10');
$pagelist->filterByAttribute('is_featured', 1, 'like');
$featured = $pagelist->get();
5fly replied on at Permalink Best Answer Reply
5fly
Hi - You should be able to use this

$pagelist = new PageList();
$pagelist->sortBy('p1.cParentID', 'asc');
$featured = $pagelist->get();
magpie replied on at Permalink Reply
Thank you that seems to work.

What is the p1.cParentID?

Thanks
5fly replied on at Permalink Reply
5fly
Its the reference to the column in the SQL that lives behind ->get() - you can access most things through there if needed.