Home Backend Development PHP Tutorial 想修改PHPCMS分页的URL 有好人吗?该怎么解决

想修改PHPCMS分页的URL 有好人吗?该怎么解决

Jun 13, 2016 pm 01:52 PM
gt page pages quot

想修改PHPCMS分页的URL 有好人吗?

PHP code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

<!--

 

Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/

 

-->

function pages($num, $curr_page, $perpage = 20, $urlrule = '', $array = array(), $catid = 0)

{

    global $PHPCMS;

    if($PHPCMS['pagemode'] &amp;&amp; $num &gt; $perpage)

    {

        $url = load('url.class.php');

        $multipage = '';

        if($num &gt; $perpage)

        {

            $page = 11;

            $offset = 4;

            $pages = ceil($num / $perpage);

            $from = $curr_page - $offset;

            $to = $curr_page + $offset;

            $more = 0;

            if($page &gt;= $pages)

            {

                $from = 2;

                $to = $pages-1;

            }

            else

            {

                if($from = $pages)

                {

                    $from = $pages-($page-2);

                    $to = $pages-1;

                }

                $more = 1;

            }

            if($urlrule == '') $urlrule = url_par('page={$page}');

 

            $multipage .= '总数:<b>'.$num.'</b>  ';

 

            if($curr_page&gt;0)

            {

                $multipage .= $catid ? '<a href="'.%24url-&gt;category(%24catid,%20%24curr_page-1,%201,%201).'">上一页</a>' : '<a href="'.pageurl(%24urlrule,%20%24curr_page-1,%20%24array).'">上一页</a>';

                 

                if($curr_page==1)

                {

                    $multipage .= '<u><b>1</b></u> ';

                }

                elseif($curr_page&gt;6 &amp;&amp; $more)

                {

                    $multipage .= $catid ? '<a href="'.%24url-&gt;category(%24catid,%201,%201,%201).'">1</a>..' : '<a href="'.pageurl(%24urlrule,%201,%20%24array).'">1</a>..';

                }

                else

                {

                    $multipage .= $catid ? '<a href="'.%24url-&gt;category(%24catid,%201,%201,%201).'">1</a>' : '<a href="'.pageurl(%24urlrule,%201,%20%24array).'">1</a> ';

                }

            }

            for($i = $from; $i category($catid, $i, 1, 1).'"&gt;'.$i.' ' : '<a href="'.pageurl(%24urlrule,%20%24i,%20%24array).'">'.$i.'</a> ';

                }

                else

                {

                    $multipage .= ' <u><b>'.$i.'</b></u> ';

                }

            }

            if($curr_pagecategory($catid, $pages, 1, 1).'"&gt;'.$pages.' <a href="'.%24url-&gt;category(%24catid,%20%24curr_page+1,%201).'">下一页</a>' : '..<a href="'.pageurl(%24urlrule,%20%24pages,%20%24array).'">'.$pages.'</a> <a href="'.pageurl(%24urlrule,%20%24curr_page+1,%20%24array).'">下一页</a>';

                }

                else

                {

                    $multipage .= $catid ? '<a href="'.%24url-&gt;category(%24catid,%20%24pages,%201,%201).'">'.$pages.'</a> <a href="'.%24url-&gt;category(%24catid,%20%24curr_page+1,%201,%201).'">下一页</a>' : '<a href="'.pageurl(%24urlrule,%20%24pages,%20%24array).'">'.$pages.'</a> <a href="'.pageurl(%24urlrule,%20%24curr_page+1,%20%24array).'">下一页</a>';

                }

            }

            elseif($curr_page==$pages)

            {

                $multipage .= ' <u><b>'.$pages.'</b></u><a href="'.pageurl(%24urlrule,%20%24curr_page,%20%24array).'">下一页</a>';

            }

        }

        return $multipage;

    }

    else

    {

        $total = $num;

        $page = $curr_page;

        if($num category($catid, 1, 1, 1);

            $prepage = $url-&gt;category($catid, $prepage, 1, 1);

            $nextpage = $url-&gt;category($catid, $nextpage, 1, 1);

            $lastpage = $url-&gt;category($catid, $pages, 1, 1);

            $urlpre = $url-&gt;category($catid, '', 1, 1);

        }

        else

        {

            $firstpage = pageurl($urlrule, 1, $array);

            $prepage = pageurl($urlrule, $prepage, $array);

            $nextpage = pageurl($urlrule, $nextpage, $array);

            $lastpage = pageurl($urlrule, $pages, $array);

            $urlpre = pageurl($urlrule, '', $array);

        }

        $data = str_replace('"', '\"', $PHPCMS['pageshtml']);

        eval("\$url = \"$data\";");

        return $url;

    }

}

 

 <div class="clear">

                  

               

               

         

            </div>

Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

What are the differences between Huawei GT3 Pro and GT4?

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Fix: Snipping tool not working in Windows 11

How to Fix Can't Connect to App Store Error on iPhone How to Fix Can't Connect to App Store Error on iPhone Jul 29, 2023 am 08:22 AM

How to Fix Can't Connect to App Store Error on iPhone

How to implement data paging and display optimization in Vue projects How to implement data paging and display optimization in Vue projects Oct 15, 2023 am 09:27 AM

How to implement data paging and display optimization in Vue projects

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决

Is watch4pro better or gt? Is watch4pro better or gt? Sep 26, 2023 pm 02:45 PM

Is watch4pro better or gt?

How to optimize iPad battery life with iPadOS 17.4 How to optimize iPad battery life with iPadOS 17.4 Mar 21, 2024 pm 10:31 PM

How to optimize iPad battery life with iPadOS 17.4

Guan Zeyuanjiang Shuying experiences Huawei MateBook GT 14: the perfect combination of technology and art Guan Zeyuanjiang Shuying experiences Huawei MateBook GT 14: the perfect combination of technology and art Aug 10, 2024 pm 09:51 PM

Guan Zeyuanjiang Shuying experiences Huawei MateBook GT 14: the perfect combination of technology and art

See all articles