如何在分页中隐藏一些页码

时间:2015-07-26 13:07:06

标签: php jquery pagination

我希望在5到5之后隐藏一些页码,但这是我的代码

<?php
            $total_no_of_pages=ceil($total_no_of_records/$records_per_page);
            $current_page=1;
            if(isset($_GET["page_no"]))
            {
                $current_page=$_GET["page_no"];
            }
            if($current_page!=1)
            {
                $previous =$current_page-1;
                echo "<a href='".$self."?page_no=1'>First</a>&nbsp;&nbsp;";
                echo "<a href='".$self."?page_no=".$previous."'>Previous</a>&nbsp;&nbsp;";
            }

            for($i=1;$i<=$total_no_of_pages;$i++)
            {
                if($i==$current_page)
                {
                    echo "<strong><a href='".$self."?page_no=".$i."' style='color:red;text-decoration:none'>".$i."</a></strong>&nbsp;&nbsp;";
                }
                else
                {
                    echo "<a href='".$self."?page_no=".$i."'>".$i."</a>&nbsp;&nbsp;";
                }
            }

            if($current_page!=$total_no_of_pages)
            {
                $next=$current_page+1;
                echo "<a href='".$self."?page_no=".$next."'>Next</a>&nbsp;&nbsp;";
                echo "<a href='".$self."?page_no=".$total_no_of_pages."'>Last</a>&nbsp;&nbsp;";
            }
            ?>

我知道我需要编辑代码的插件,如

for($i=1;$i<=$total_no_of_pages;$i++)
            {
                if($i==$current_page)
                {
                    echo "<strong><a href='".$self."?page_no=".$i."' style='color:red;text-decoration:none'>".$i."</a></strong>&nbsp;&nbsp;";
                }
                else
                {
                    echo "<a href='".$self."?page_no=".$i."'>".$i."</a>&nbsp;&nbsp;";
                }
            }

是否可以通过较小的修正进行修改,请不要重复,因为我没有得到所需的答案

提前致谢

1 个答案:

答案 0 :(得分:0)

怎么样?

let startVC: UIViewController = viewControllerAtIndex(indexImage)

let viewControllers: [UIViewController] =
    Array<UIViewController>(arrayLiteral: startVC)

pageViewController.setViewControllers(viewControllers,
    direction: UIPageViewControllerNavigationDirection.Forward,
    animated: true, completion: nil)