Jump to content

page numbering


fazzfarrell

Recommended Posts

I have at the top of my pages 'previous'  'page 1 of 7'    'next'

 

When the user clicks on next it will say page 2 of 7 etc

 

heres my code works fine:

<td width="230" align="right"><a href="<?php printf("%s?pageNum_rsProd=%d%s", $currentPage, min($totalPages_rsProd, $pageNum_rsProd + 1), $queryString_rsProd); ?>">Next Items <img src="next.jpg" alt="next" width="15" height="15" align="absmiddle" /></a></td>

 

What I want to do is when the user gets to page 7 'the next' link will be hidden, any one help?

Link to comment
https://forums.phpfreaks.com/topic/57419-page-numbering/
Share on other sites

'um, something like:

 

<td>
<?php 

if($currentPage != 7){  ?>

<a href="<?php printf("%s?pageNum_rsProd=%d%s", $currentPage, min($totalPages_rsProd, $pageNum_rsProd + 1), $queryString_rsProd); ?>
">Next Items <img src="next.jpg" alt="next" width="15" height="15" align="absmiddle" /></a>

<?php

}else{

echo $currentPage;

}


?>
</td>

Link to comment
https://forums.phpfreaks.com/topic/57419-page-numbering/#findComment-284049
Share on other sites

<td width="230" align="right">
<?php
if ($pageNum_rsProd < $totalPages_rsProd) {
     echo '<a href="' . $currentPage . '?pageNum_rsProd=' . min($totalPages_rsProd, $pageNum_rsProd + 1) . $queryString_rsProd . '">Next Items <img src="next.jpg" alt="next" width="15" height="15" align="absmiddle" /></a>';
}
?>
</td>

Link to comment
https://forums.phpfreaks.com/topic/57419-page-numbering/#findComment-284055
Share on other sites

great works a treat from that I have been trying to do the 'previous page' link

 

<td width="230" align="left"> <a href="<?php printf("%s?pageNum_rsProd=%d%s", $currentPage, max(0, $pageNum_rsProd - 1), $queryString_rsProd); ?>"><img src="previous.jpg" alt="preivous" width="15" height="15" align="absmiddle" /> Previous Items</a></td>
            <td width="80" align="left"><div align="center">Page <?php echo ($pageNum_rsProd + 1) ?> of <?php echo ($totalPages_rsProd + 1) ?></div></td>

 

i tried

<td width="230" align="right"><?php
if ($pageNum_rsProd < $totalPages_rsProd) {
     echo '<a href="' . $currentPage . '?pageNum_rsProd=' . min($totalPages_rsProd, $pageNum_rsProd - 1) . $queryString_rsProd . '">Next Items <img src="next.jpg" alt="next" width="15" height="15" align="absmiddle" /></a>';
}
?>
            </td>

 

but didn't work I can't see how it is working?

Link to comment
https://forums.phpfreaks.com/topic/57419-page-numbering/#findComment-284062
Share on other sites

<td width="230" align="right"><?php
if ($pageNum_rsProd == 1) {
     echo '<a href="' . $currentPage . '?pageNum_rsProd=' . min($totalPages_rsProd, $pageNum_rsProd - 1) . $queryString_rsProd . '">Next Items <img src="next.jpg" alt="next" width="15" height="15" align="absmiddle" /></a>';
}
?>
            </td>

 

Set it equal to one, for the previous we do not need to know how many total pages are. If the page is the 1st page there is no previous.

Link to comment
https://forums.phpfreaks.com/topic/57419-page-numbering/#findComment-284067
Share on other sites

put this on the page with a slight ammendment changing next ro previous

<td width="230" align="right"><?php
if ($pageNum_rsProd == 1) {
     echo '<a href="' . $currentPage . '?pageNum_rsProd=' . min($totalPages_rsProd, $pageNum_rsProd - 1) . $queryString_rsProd . '"><img src="previous.jpg" alt="previous" width="15" height="15" align="absmiddle" /> </Previous Items a>';
}
?>
            </td>

 

it works on the first click but then on the next the previous disapears!

Link to comment
https://forums.phpfreaks.com/topic/57419-page-numbering/#findComment-284081
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.