With the following code, I list the subpages of a particular page. However, this code lists all the sub-pages. But what I want is to list the last 5 sub-pages. How can I limit the number of pages listed?
<?php// 1. Let's make our auxiliary classes.$th= Core::make('helper/text');$ih= Core::make('helper/image');$dh= Core::make('helper/date');// 2. Let's get the block here.$nbo_bo= BlockType::getByHandle('autonav');$nbo=$nbo_bo->controller;$nbo->orderBy='chrono_desc';$nbo->displayPages='custom';$nbo->displayPagesCID= Page::getByPath('/pagename')->getCollectionID();$nbo->displaySubPages='all';$nbo->displaySubPageLevels='all';// 3. Let's start creating the screen display.$nbo_items=$nbo->getNavItems();
use Page;
use PageList;$cParentID= Page::getByPath('/pagename')->getCollectionID();$list=new PageList();$list->filterByParentID($cParentID);$list->sortByDisplayOrderDescending();$pagination=$list->getPagination();$pagination->setMaxPerPage(1);$pageResults=$pagination->getCurrentPageResults();
Code
Post Reply
Delete Post
You are allowed to delete your post for 5 minutes after it's posted.