is pagination in flat file possible like depenind on the number of files in a folder or something like dat
i want the code for when there are 172 files in a folder i want 50 files to be displayed per page how can i do that
If the flat file's records are seperated on a per line basis open the file explode the data by "\r" (carriage return) Count the newly created array from the explode You now have how many records are in your file. Pagination is childs play once you know that.
I believe that the \r is only added on Windows machines. I think it's safer to use this method to get the number of records. $records = sizeof(file('your-file.txt')); PHP:
The extension doesn't matter as long as each record is in a new line. As for the folder question, what do you want to do? Count all files in a folder? $files = sizeof(glob('/path/to/files/*.txt')); PHP: You can play with glob(). What format do your files have?
i want them the count and do pagination for them like if 100 files are there i want 15 to appear per page and then pages like 1 2 3 4 5 6 etc etc appear