You have the instruction in your code, but commented.
The query setLimit()
function requires two parameters:
$limit
: the number of records to return, and$offset
: the first record you want to return, zero-based.
This is the signature of the function:
public function setLimit($limit = 0, $offset = 0)
Please take notice that the parameter order is opposite that of mysql:
LIMIT [offset,] row_count;
Then you will need to draw some pagination buttons
echo "<a href=".JRoute::_("index.php?page=1& ...
and so on, and figure out the $offset
parameter from that. JRoute omitted for clarity.
I should add that you could also code your model extending ListModel
, and then you'd get pagination for free, courtesy of Joomla. To try and sell this better, consider that all of the above would run down to a call like:
echo $this->pagination->getListFooter();
You can find some info on Joomla MVC Docs and sample code on Joomla component tutorial, but ultimately it would be faster to just read how it's done in the core Joomla components, it's quicker, and you always learn something reading Joomla code.