hi all,
I am trying to add pagination to my forms using J! defaults
in the html of form listresults I've added:
$total is currently 6. with List Length in global config set to 5 the list-footer would properly display with the limit box set to 5 and 2 pages indicated as available.
for getting the pagination appliad to the list of rows I adjusted in ../administrator/components/com_chronoforms/admin.chronoforms.php in function show_data
for:
Similar to the change in the order by mentioned in this thread
http://chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=21986
the applied changes are not working. what am I doing wrong ? 😶
I am trying to add pagination to my forms using J! defaults
in the html of form listresults I've added:
<?php
// prepare pagination
global $mainframe;
$database = JFactory::getDBO();
$user = JFactory::getUser();
$limit = $mainframe->getCfg('list_limit');
$limitstart = JRequest::getInt('limitstart', 1);
$limitstart = ( $limit != 0 ? (floor($limitstart / $limit) * $limit) : 0 );
$database->setQuery("SELECT COUNT(*) AS total FROM #__chronoforms_data_results WHERE `cf_user_id` = '".$user->id."' ");
$total = $database->loadResult();
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
?>
<form action="<?php echo JRoute::_('index.php?option=com_chronoforms&Itemid='.$Itemid); ?>" method="post" name="form">
<p>
<?php if($limit < $total) echo $pageNav->getListFooter(); ?>
</p>
</form>
$total is currently 6. with List Length in global config set to 5 the list-footer would properly display with the limit box set to 5 and 2 pages indicated as available.
for getting the pagination appliad to the list of rows I adjusted in ../administrator/components/com_chronoforms/admin.chronoforms.php in function show_data
if(isset($_POST['cb']) && !empty($_POST['cb'])){
$database->setQuery("SELECT * FROM ".$table_name." WHERE ".$primary."='".$_POST['cb'][0]."'
ORDER BY `date` DESC, `group_select`");
for:
// prepare pagination
$user =& JFactory::getUser();
$limit = $mainframe->getCfg('list_limit');
$limitstart =& JRequest::getInt('limitstart', 1);
$limitstart = ( $limit != 0 ? (floor($limitstart / $limit) * $limit) : 0 );
$database->setQuery("SELECT COUNT(*) AS total FROM #__chronoforms_data_results WHERE `cf_user_id` = '".$user->id."' ");
$total = $database->loadResult();
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
//show data
if(isset($_POST['cb']) && !empty($_POST['cb'])){
$database->setQuery("SELECT * FROM ".$table_name." WHERE ".$primary."='".$_POST['cb'][0]."'
ORDER BY `date` DESC, `group_select`
LIMIT $pageNav->limitstart,$pageNav->limit");
Similar to the change in the order by mentioned in this thread
http://chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=21986
the applied changes are not working. what am I doing wrong ? 😶