Joomla Back End MVC Step by Step Tutorial - Part 4: We have made list table for back end at here. Now, we will add a feature for that table, paginating.
Open again your "controller.php" within Joomla\administrator\components\com_hello. Edit like following code:

<?
defined('_JEXEC') or die('Restricted Access');
jimport('joomla.application.component.controller');
class HelloController extends JController
{
function __construct ($default = array())
{
parent::__construct( $default );
}
function showHellos()
{
global $options, $mainframe;
$limit = JRequest::getVar('limit',
$mainframe->getCfg('list_limit'));
$limitstart = JRequest::getVar('limitstart', 0);
$db =& JFactory::getDBO();
$query = "SELECT count(*) FROM #__hello";
$db->setQuery( $query );
$total = $db->loadResult();
$query = "SELECT * FROM #__hello";
$db->setQuery ( $query, $limitstart, $limit);
$rows = $db->loadObjectList();
if ($db->getErrorNum())
{
echo $db->stderr();
return false;
}
jimport( 'joomla.html.pagination' );
$pageNav = new JPagination($total, $limitstart, $limit);
HTML_hellos::showHellos( $option, $rows, $pageNav );
}
}
?>
Next, we will modify our admin.html.