Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Convey sequential number to next listing page

 

 


nmsinc
User

Jan 6, 2012, 3:11 PM

Post #1 of 2 (181 views)
Shortcut
Convey sequential number to next listing page Can't Post

I need to list Id numbers next to our listings using code below:



<?php $i = 0; ?>



<?php foreach ($lodgingRecords as $record): ?>

<?php $i = $i + 1; ?>

(#<?php echo $i ?>) <?php echo $record['lodging_name'] ?>



<?php endforeach ?>



The list per page is set to seven. Because the first line of the listing code sets the value to zero the next page numbering starts over again at the number one (#1). How can I correct this issue on all next and all preceding pages?



Thanks - nmsinc


Jason
Staff / Moderator


Jan 8, 2012, 5:31 PM

Post #2 of 2 (170 views)
Shortcut
Re: [nmsinc] Convey sequential number to next listing page [In reply to] Can't Post

Hi,

Instead of setting the variable to 0, you can set it to 7 * the current page number -1

For example:

<?php
if ($lodgingMetaData['page']) {
$i = 7 * (intval($logdingMetaData['page']) - 1 );
}
else {
$i = 0;
}
?>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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