splitting content into pages

From: Date: Mon, 04 Aug 2003 04:00:49 +0000
Subject: splitting content into pages
Groups: php.general 
Request: Send a blank email to php-general+get-158115@lists.php.net to get a copy of this message
thanks to the poster on the substr page i made a modification to it so it now splits the content into pages lemme know anyone if this is useful usage: page_content($content,15,$_GET['page']); function page_content($content,$limit,$page) { $array = explode("\r\n", $content); $maxline = count($array); if ($maxline > $limit) { $max = $maxline - 1; $page ? $page = $page : $page = 1; $page ? $next = $limit * ($page - 1) + 1 : $next = 1; $s=$next+$limit; for ($i=$next; $i<$s; $i++) { if ($array[$i]!="") $formatted_content .= $array[$i]."\n\n"; //$dtrow = explode("|", $array[$i]); //$row = "$dtrow[0]"; //$formatted_content .= $row."\n"; } $p = 1; $u = ceil($max/$limit); for ($t=1; $t<$u; $t++) { $t == $page ? $formatted_content .= "<b>$t</b>&nbsp; " : $formatted_content .= "<a href=\"".$_SERVER['PHP_SELF']."?".url ('page', "page=$t")."\">$t</a>&nbsp; "; $p=$p+$limit; } return $formatted_content; } return $content; }

« previous php.general (#158115) next »