douniewei6346 2012-07-31 13:36
浏览 12

显示超出当前页面的分页数。

UPDATE: I have revised my code and I now can display current page but it shows 0 for first page. and when they move onto more pages it shows current page and previous pages. How do I get it to show a set number of pages.

<div id="paging">       
<div class="page">
    <?php if ($pageNum_getDisplay > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_getDisplay=%d%s", $currentPage, 0, $queryString_getDisplay); ?>">First</a>
                <?php } // Show if not first page ?></div>
<div class="page">
    <?php if ($pageNum_getDisplay > 0) { // Show if not first page ?>
                <a href="<?php printf("%s?pageNum_getDisplay=%d%s", $currentPage, max(0, $pageNum_getDisplay - 1), $queryString_getDisplay); ?>">Previous</a>
                <?php } // Show if not first page ?></div>
<div class="page">
    <?php for ($i=0;$i<=$pageNum_getDisplay;$i++){     
    if ($pageNum_getDisplay==$i)         
    echo ($i);     
    else         
    echo "<a title='Page $i' href='?pageNum_getDisplay=$i'><strong>$i</strong></a>"; 
    } ?> </div>
<div class="page"> 
    <?php if ($pageNum_getDisplay < $totalPages_getDisplay) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_getDisplay=%d%s", $currentPage, min($totalPages_getDisplay, $pageNum_getDisplay + 1), $queryString_getDisplay); ?>">Next</a></div>             
<div class="page">
    <?php } // Show if not last page ?>
            <?php if ($pageNum_getDisplay < $totalPages_getDisplay) { // Show if not last page ?>
                <a href="<?php printf("%s?pageNum_getDisplay=%d%s", $currentPage, $totalPages_getDisplay, $queryString_getDisplay); ?>">Last</a>
                <?php } // Show if not last page ?>
        </div>

I want to display it so it looks like this.

(first page) 1 2 3 4 5 6 7 Next Last (second page) First Previous 1 2* 3 4 5 6 7 Next Last

right now it looks like this .. First Previous 0 1 2 Next Last

Thanks in advance

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度