Re: splitting content from database into pages again
| From: | daniel at electroteque dot org | Date: | Fri, 01 Aug 2003 01:31:16 +0000 |
| Subject: | Re: splitting content from database into pages again | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157859@lists.php.net to get a copy of this message | ||
function page_content($content,$limit = 10,$page) {
$limit=20;
$afile = explode("\r\n", $content);
$maxline = count($afile); // count existing lines
$max = $maxline - 1;
$page ? $page = $page : $page = 1;
$s=$page+$limit;
for ($i=$page; $i<$s; $i++) {
$dtrow = explode("|", $afile[$i]);
$row = "$dtrow[0]";
$formatted_content .= $row."\n";
}
$p = 1;
$u = ceil($max/$limit);
for ($t=1; $t<=$u; $t++) {
$formatted_content .= "<a href=\"$PHP_SELF?
page=$p\">$t</a> ";
$p=$p+$limit;
}
return $formatted_content;
}