Page 1 of 1

pagination of .txt files in php

Posted: Wed Nov 01, 2006 2:34 pm
by moisea
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi, i would like to know how to get the a php pagination for txt files as shown below

Code: Select all

<?php 
$filename="mycontent.txt";
$fp=fopen ($filename, "r") or die ("Couldn't open $filename");
while (! feof ($fp))
	{ 
	$line = fgets ($fp, 1024);
	print "$line<br>";
	}
?>
i need a php pagination please, as i have about 7 .txt files to display on different pages.
any ideas on how to get this sorted?
many thanks for having a look.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Nov 01, 2006 2:40 pm
by feyd

Posted: Wed Nov 01, 2006 3:20 pm
by timvw
http://www.timvw.be/pagination-for-all has also an example where the contents of .bashrc file are paginated...

Posted: Wed Nov 01, 2006 5:47 pm
by moisea
hi tim great tut, however i am running thru some trouble now. send you an email through the link you gave me. many thanks again.

Posted: Wed Nov 01, 2006 10:04 pm
by alex.barylski
Just an observation...

But files listed as paginated results...is probably the one and only time you *don't* want to paginate results...ergonomically most people (myself included) expect files to be listed completely...any pagination is usually handled implicitly through directories/folders which the user creates...

Cheers :)

Posted: Thu Nov 02, 2006 5:51 am
by onion2k
Hockey wrote:But files listed as paginated results...is probably the one and only time you *don't* want to paginate results...ergonomically most people (myself included) expect files to be listed completely...any pagination is usually handled implicitly through directories/folders which the user creates...
So why does Unix have the 'more' command (eg ls -a | more )? ;)

Paging through things is always a good idea if you have a long list. You should be able to sort, search, filter, and control the number of items returned too. For everything. Even files.

Posted: Thu Nov 02, 2006 6:51 am
by theFool
I would say, it depends on the amount of files. Having more then... maybe 500... files on one page, would somehow scare me.

Posted: Thu Nov 02, 2006 11:58 am
by alex.barylski
onion2k wrote:
Hockey wrote:But files listed as paginated results...is probably the one and only time you *don't* want to paginate results...ergonomically most people (myself included) expect files to be listed completely...any pagination is usually handled implicitly through directories/folders which the user creates...
So why does Unix have the 'more' command (eg ls -a | more )? ;)

Paging through things is always a good idea if you have a long list. You should be able to sort, search, filter, and control the number of items returned too. For everything. Even files.
Thats a good point... :P But I've yet to see a GUI file explorer that paginated results??? Obviously it's possible...but my point was that for files at least, it's going against common convention...from what I've experienced.

Of course I don't exactly tinker with file managers all to much...so what do I know :)

Posted: Thu Nov 02, 2006 12:22 pm
by moisea
that's exactly what is happening in my case Hockey, i have a folder that holds just under 10 files which i am trying to paginate. i am still working on it though...