Log in

View Full Version : How to add next/ prev page function



killerchutney
05-17-2007, 08:53 PM
I found a news posting script thats perfect in every way apart from the fact it does not have a previous/ next link function. It is flat-file based and saves each article in a new html document. here is the php code for the page where i'd want the prev next buttons to be.

<?

require('config.php');

$filename = "article_summary.html";

#- open article summaries
if(file_exists($filename)){
$fh = fopen($filename, "r");
$old_news = fread($fh, filesize($filename));
fclose($fh);
}


#- get first five article
$articles = explode("<!--ARTICLE-->", $old_news);

$i=0;
foreach ( $articles as $article ){
if(count($articles)>$i){
if($max_latest >= $i++){
print $article;
}
}
}

?>


I have it installed at http://www.killerchutney.co.uk/contentbeta/latest.php
Please help, thanks.

boogyman
05-17-2007, 11:55 PM
you are talking about pagination

djr33
05-18-2007, 03:24 AM
http://www.php-mysql-tutorial.com/php-mysql-paging.php