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}