PHP News Content Pagination code example tutorial

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags code content example pagination php programming web

News content Pagination code example tutorial
Unction explode_content ($content, $length) {

$i = 0;

$k = 1;

$j = 0;

$wn = 0;

$s = ';

$e = 1;

$YH = 0;

while ($k) {

$d = $content [$i];

One if ($d!== ') {

if (ord ($d) > 127) {

$j + +;

$num = 2;

$i + +;

else {

$num = 1;

18}

$j + +;

else {

if ($s) {

$listdb [] = addslashes ($s);

23}

$k = 0;

25}

$v 1 = $j-$num;

$w = substr ($content, $v 1, $num);

if ($w!== ') {

29

if ($w = = ' < ') {

$e = 0;

32}

if (! $e && $w = = ' ") {

$yh + +;

35}

if ($e && $w!= ' && $w!= ') {

Panax Notoginseng $wn + +;

38}

($w = = ' > ' && $yh% 2 = 0) {

$e = 1;

41}

$s. = $w;

43}

if ($wn >= $length && $e) {

$listdb [] = addslashes ($s);

$s = ';

$wn = 0;

48}

$i + +;

50}

$listdb;

52}

53

54

55

56 Paging use

$page _per = 500; Number of words per page
PHP article content pagination
$article _list = explode_content ($article, $page _per); Split article

$page _count = count ($article _list);

$page =!empty ($_get[' page ')? Intval ($_get[' page '): 1;

$page = ($page > $page _count && $page _count>0)? $page _count: $page;

$article = Strips Tutorial Lashes ($article _list[$page-1]);

if ($page _count>1) {

if ($page = = 1) {

$page _code = "<a href=" news.php?id= $id &page=. ($page + 1). " > Next </a> <a href= "news.php?id= $id &page= $page _count" > Last page </a> ";

66}

ElseIf ($page = = $page _count) {

$page _code = "<a href=" news.php?id= $id &page=. ($page-1). "" > prev </a> <a href= "news.php?id= $id &page=1" > Home </a> ";

Or else {

$page _code = "<a href=" news.php?id= $id &page=. ($page + 1). " > next page </a> <a href= "news.php?id= $id &page=". ($page-1). "" > Prev </a> ";

71}

72}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.