Hello,
I have some listings display in the homepageDetail viewer,
However, there is some problem about the pagination.
The pagination displayed as below.
Prev 1 2 3 4 Next
There is no problem on the Prev and Next.
The url shown homepageDetail.php?2=&page=2
BUT the url shown on 1 2 3 4
Just displayed as homepageDetail.php?0=&page=2
i.e. the users num 2 becomes 0
Actually it works on all the pages with letter after the question mark ?cat=
BUT when the page end with a number ?32
All the number will becomes ZERO
-----------------------------------------------------------------------------------
<?php
require_once "init.php";
list($homepageRecords, $homepageDetails) = getRecords(array(
'tableName' => 'homepages',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
list($listingRecords, $listingDetails) = getRecords(array(
'tableName' => 'listings',
'where' => "agent LIKE '%\t" . getNumberFromEndOfUrl()."\t%'",
'perPage' => '10',
));
$homepage = @$homepageRecords[0]; // get first record
if (!$homepage) { print "Homepage not found!"; exit; }
?>
<!-- show prev/next page links -->
<div class="pagination">
<div class="item-total">Page <?php echo $listingDetails['page'] ?> of <?php echo $listingDetails['totalPages'] ?></div>
<ul>
<?php if ($listingDetails['prevPage']): ?>
<li><a href="<?php echo $listingDetails['prevPageLink'] ?>">Prev</a></li>
<li> <a href="?<?php echo http_build_query(array_merge($_REQUEST, array( 'page' => '1' ))) ?> ">1</a></li>
<li><span>...</span></li>
<?php else: ?>
<?php endif ?>
<?php
if (@!$_GET['page']): $current_page = "1";
else: $current_page = $_GET['page'];
endif; ?>
<?php
$startNumber = max($current_page - 3, 1);
$endNumber = min($current_page + 3, $listingDetails['totalPages']);
?>
<?php foreach (range($startNumber,$endNumber) as $page): ?>
<?php if ($page == $current_page): ?>
<li class="active first-bg-hover"><a><?php echo $page; ?></a></li>
<?php else: ?>
<li><a href="?<?php echo http_build_query(array_merge($_REQUEST, array( 'page' => $page ))) ?>"><?php echo $page; ?></a></li>
<?php endif ?>
<?php endforeach; ?>
--------------------------------------------------------------------
Please so kindly solve it.
Thanks a lot