Thursday, December 17, 2009

Joomla jxListFiles with Pagination

Heres a quick upgrade to the jxListFiles Joomla module to setup pagination.

Just replace the /mod_jxlistfiles/tmpl/default.php with this code

<?php // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); 
require_once(  JPATH_ROOT.DS.'/libraries/joomla/html/pagination.php' );    
$pageLimit  = JRequest::getVar('limit', 10, '', 'int');
$pageStart  = JRequest::getVar('limitstart', 0, '', 'int');

$pageNav = new JPagination( count($filelist), $pageStart, $pageLimit);
$genCounter=1;

?>

<ul class="jxfilelist">
<?php foreach($filelist as $file): ?>
<?php $genCounter++; 
if($genCounter >= $pageStart && $genCounter<=($pageStart+$pageLimit)): ?>
<?php if ($params->get('linkfiles') == 'yes'): ?>
<li class="<?php echo $file->class; ?>"><a href="<?php echo $params->get('url') . '/' . $file->filepath; ?>"><?php echo $file->filename; ?></a></li>
<?php else: ?>
<li class="<?php echo $file->class; ?>"><?php echo $file->filename; ?></li>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>

<form id="pagination" method="post">
<?php echo $pageNav->getListFooter(  ); //Displays a nice footer  ?>
</form>


Stumble Upon CodePyro

1 comment:

Calendar extension joomla said...

Am also searching for the same issue,it's a great information for me,this coding guided me to get the solution,thanks

Post a Comment