Shuffling paginated records by page

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 1, 2014   (RSS)

Hi All,

I’m using
perPage,
$my_list_tableMetaData['totalPages'],  $my_list_tableMetaData['nextPage'] and
$my_list_tableMetaData['prevPages'] to paginate the number of images that appear on a results list page.

Full code is below

I’d like to shuffle the records returned, but only on each page and not globally, so that the records on page 1 are shuffled separately, and the records on page 2 are shuffled separately, etc..

Any suggestions?

Thanks,

Jerry Kornbluth

<?php // load records from 'my_list_table'
  list($my_list_tableRecords, $my_list_tableMetaData) = getRecords(array(
'tableName'   => 'my_list_table',
'perPage' => 25,
  ));
 ?>

There are <?php echo $my_list_tableMetaData['totalRecords']; ?> Listings<br />
<?php if ($my_list_tableMetaData['totalPages'] > 1): ?>

This is <?php echo $my_list_tableMetaData['page'] ?> of <?php echo $my_list_tableMetaData['totalPages'] ?></span>

<?php if ($my_list_tableMetaData['nextPage']): ?>
 <br />
<a href="<?php echo $my_list_tableMetaData['nextPageLink'] ?>">Click-Tap for more</a>
<?php endif ?>

<?php if ($my_list_tableMetaData['prevPage']): ?>
<br />
<a href="<?php echo $my_list_tableMetaData['prevPageLink'] ?>">Click-Tap for previous</a>
<?php endif ?>
<br />
<?php endif ?>

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Damon - December 31, 2013

Hi Jerry,

Try out something like this:

<?php shuffle($my_list_tableRecords);

<?php foreach $$my_list_tableRecords as $record): ?>
 
 etc....


Let me know if this works for you.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/