The question is really simple: Can I use the standard paginator to paginate data that doesn't come from the main database? For example, to paginate an array, a file, or data fetched without using JDatabase?

If it's possible, how can I do this?

1 Answer 1


I think it is posible. althoug I have not done if before.

The pagination uses as parameters the total number of records that in your case is the array count, the limitstart (index where to start), and the page size.

This is an example in one of my models to get the pagination object

function getPagination()

    if (empty($this->_pagination)) {
            $this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'),$this->getState('limit') );
    return $this->_pagination;

Sustitute $this->getTotal() for array count and so on.

Also, on the function to retrieve the data you should have and equivalent funciotn to this

$rows = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));

to get the information from your structure

  • I don't understand the last part: Do you mean that in my getItems() functions I should have something like the $rows = $this->_getList() call? As far as I understand, returning a subarray of limit elements starting on limitstart will be enough, isn't it?
    – mHouses
    Sep 18, 2015 at 6:34
  • 1
    I just put he way we do with the database, but you are right. You should have a way to return the subarray using limistart and limit Sep 18, 2015 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.