moise Posted November 3, 2006 Share Posted November 3, 2006 hi, i was using test files to display some of my website contents[code]<div id="content"><p> <?php $filename="mypagecontent.txt";$fp=fopen ($filename, "r") or die ("Couldn't open $filename");while (! feof ($fp)) { $line = fgets ($fp, 1024); print "$line<br>"; }?></p></div>[/code], however, i have a page were i would like to display several contents (7) at the same place with pagination. all files are in a folder and i would please like some help to sort this out. any help is welcome...many thanks. Quote Link to comment Share on other sites More sharing options...
moise Posted November 3, 2006 Author Share Posted November 3, 2006 come on please! LOL ...any help would be appreciated...desparate here! Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 3, 2006 Share Posted November 3, 2006 [code]<?phptxtArray = ("file1.txt", "file2.txt", "file3.txt", "file4.txt", "file5.txt", "file6.txt", "file7.txt");$thisPage = (isset($_GET[page])) ? $_GET[page] : txtArray[0];echo "<div class=\"pagination\">";$pageNum = 0;foreach (txtArray as $fileName) { $pageNum++; if ($fileName==$thisPage) { echo " " . $pageNum . " " } else { echo " <a href=\"urlToThisPage?page=" .$pageNum . "\">" . $pageNum . "</a> " }}echo "</div>";echo "<br>\n";echo "<div id=\"content\"><p>\n";$fp=fopen ($thisPage, "r") or die ("Couldn't open $thisPage");while (! feof ($fp)) { $line = fgets ($fp, 1024); print "$line<br>"; }echo "</p></div>\n";?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.