Click here to Skip to main content
15,174,684 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Currently I am trying count and numbering pagination system.
Actually script is working with built next prev pagination and now need counting pagination.
There is on page variable result $page and it is returned by a remote API with the number of pages available so here is the class snipet and if someone is willing to adopt this into numbering pagination
<div class="pagination">
	<div class="pagi"><?=_RESULTS?>: <span class="query"><?=$tag?></span></div>
	<? if ($service->pagination()): ?>
	<div class="pagd">
		<? if ($page > 1): ?>
		<a href="<?=BASE_URL?>/<?=$op?>/tag/<?=$tag?>/<?=($page-1)?>.html">« <?=_PREVIOUS?></a> 
		<? endif; ?>
		<?=_PAGE?> <span class="pagnumtop"><?=$page?></span> 
		<a href="<?=BASE_URL?>/<?=$op?>/tag/<?=$tag?>/<?=($page+1)?>.html"><?=_NEXT?> »</a>
	<? endif; ?>
	<div style="clear: both"></div>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900