Convey sequential number to next listing page
2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 8, 2012 (RSS)
By nmsinc - January 6, 2012
I need to list Id numbers next to our listings using code below:[/#000000]
[/#000000]
<?php $i = 0; ?>[/#000000]
[/#000000]
<?php foreach ($lodgingRecords as $record): ?>[/#000000]
<?php $i = $i + 1; ?>[/#000000]
(#<?php echo $i ?>) <?php echo $record['lodging_name'] ?>[/#000000]
[/#000000]
<?php endforeach ?>[/#000000]
[/#000000]
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?[/#000000]
[/#000000]
Thanks - nmsinc[/#000000]
[/#000000]
<?php $i = 0; ?>[/#000000]
[/#000000]
<?php foreach ($lodgingRecords as $record): ?>[/#000000]
<?php $i = $i + 1; ?>[/#000000]
(#<?php echo $i ?>) <?php echo $record['lodging_name'] ?>[/#000000]
[/#000000]
<?php endforeach ?>[/#000000]
[/#000000]
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?[/#000000]
[/#000000]
Thanks - nmsinc[/#000000]
nmsinc
Re: [nmsinc] Convey sequential number to next listing page
By Jason - January 8, 2012
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
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 - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/