Re: split in to multiple pages ( pagination)

From: Date: Tue, 18 Sep 2007 14:43:08 +0000
Subject: Re: split in to multiple pages ( pagination)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-262200@lists.php.net to get a copy of this message
In news: Pine.LNX.4.64.0709151021110.30917@destiney.com.theplanet.host - Greg Donald wrote : >> On Sat, 15 Sep 2007, Joker7 wrote: >>> I'm using the code below to display news articles-which works great >>> apart from. I can control the number of articles,but I would like >>> to add a link to the bottom of the page to the un-displayed >>> articles ( nexted 5 articles and so on) any pointers would be most >>> welcome as most know my PHP skills are not the best :). >> >> <? >> >> $max_latest = 5; >> $filename = "articlesum.php"; >> >> #- open article >> if(file_exists($filename)){ >> $fh = fopen($filename, "r"); >> $old_news = fread($fh, filesize($filename)); >> fclose($fh); >> } >> #- get article >> $articles = explode("<!--ARTICLE-->", $old_news); >> >> $i=0; >> foreach ( $articles as $article ){ >> if(count($articles)>$i){ >> if($max_latest >= $i++){ >> print $article; >> } >> } >> } >> >>> >> There's a bunch of how-tos and discussion on this topic already: >> >> http://google.com/search?q=php+pagination >> >> You have to manage a variable across page requests to keep track of >> where you are. Use that variable in your SQL as part of your >> offset/limit parameters. >> >> >> -- >> Greg Donald >> Cyberfusion Consulting >> http://cyberfusionconsulting.com/ Thanks for the reply - I now know what it's called :) I forgot to and it's a flat file system not the best but is ok for my needs. I spent a couple of hours following link from google an not a sausage on flat files :( Chris

« previous php.general (#262200) next »