Paginating A Block Other Than Page_List

Permalink
BACKGROUND:
I've got a bunch of entries sitting in a autonav block template. It would be nice if they could be paginated i.e. (only 5 or so results appearing per page).

Similar to the page_list block, the entries are already sitting in an array.

QUESTION:
1. Is there a way to load the features of page_list's pagination in a different block (or even a template page on it's own)?

NOTES:
Are any of these loaders be helpful?:

Loader::library('item_list');
   Loader::model('page_list');
   Loader::helper('pagination');
   Loader::controller('page_list');

setItemsPerPage(5) can be used to display the number of results.

I had a read through
http://www.concrete5.org/documentation/developers/system/searching-...

2. Should I be extending the DatabaseItemList?
- if so with what function?
class ArticleSearchList extends DatabaseItemList  {
    public function pagArticles() {
    ...?
    }
}

Any help is greatly appreciated! I'm sure this would be a nice addon for others too.

 
Remo replied on at Permalink Reply
Remo
like this

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
Loader::library('item_list');
class LovelyList extends DatabaseItemList {
   private $queryCreated;
   protected function setBaseQuery() {
      $this->setQuery('SELECT field_a, field_b FROM lovely_table');
   }
   protected function createQuery(){
      if(!$this->queryCreated){
         $this->setBaseQuery();
         $this->queryCreated=1;
      }
   }
   public function get($itemsToGet = 0, $offset = 0) {
Remo replied on at Permalink Reply
Remo
ups, sorry, I haven't realized that I had a filter in the forum and was looking at a post from 2010.. At least we have an answer now ;-)
zoinks replied on at Permalink Reply
Any idea how I could paginate this?

<?php
            //Blog archives list
               echo '<h4>News/Blog Archive</h4><div style="font-size:13px;">' ;
               $nav = BlockType::getByHandle('autonav');
               $nav->controller->orderBy = 'display_asc';
               $nav->controller->displayPages = 'custom';
               $nav->controller->displayPagesCID = '119';
               $nav->controller->displaySubPages = 'relevant';
               $nav->render('view');
               echo '</div>' ;
              ?>
Remo replied on at Permalink Reply
Remo
You're mixing two different things, the PageList mentioned in this discussion is a class, not a block. It's meant for developers to be able to build their own add-ons.

There's no easy way to do what you want. You'd probably have to build your own block.
zoinks replied on at Permalink Reply
Drat. I wish I understood anything. Thanks, I'll go look for a block-making tutorial. I've seen one before, but it was above my head then and probably still is, but I'll give it a shot.

In the meantime, if you're still around and feel like answering, do you have any idea if there's a standard sort of Blog Archive that shows more than just months which click to a special "month page?" I want something like an accordion where you can click "January" and then see all the January blog article links in the sidebar rather than jumping to a January page.
Remo replied on at Permalink Reply 1 Attachment
Remo
Doesn't the date nav block do pretty much what you're looking for? I've attached a screenshot where you can see "markus", an actual page you can jump to without the need of a special "month page"
zoinks replied on at Permalink Reply
hm, maybe it does! I've never used or even noticed the date block before. It automagically "hitches up" to the blog?
Remo replied on at Permalink Best Answer Reply
Remo
Give it a try, you only have to select the page type, probably "Blog Entry" and you'll immediately see how it looks
zoinks replied on at Permalink Reply
Wow, I'm looking at it now. Looks like exactly what I need. Thank you!