I have a website part of which contains the records for a club. Each day’s records are stored in their own file with the format yyyymmdd.php (I use PHP includes to cut down on the amount of repeated code).
Each records page has a link to the previous day, the index, and the next day. Is there some code I can write to have the previous and next day links automatically go to the previous and next dated files in the directory, rather than having to put the filenames in manually? Something like:
<a href=automatic link to previous day>Previous and the same for the next day, rather than:
Previous.
Not every day has its own record, so it’s not as simple as simply cycling back or forward through the calendar.
I have tried using the code for answer 1 to this question.
However, while it works for the first page in the directory, subsequent pages act as if they ARE still the first page: the $currentIdx remains at 0 and the ‘Next Day’ link always links to the second day, not the third, fourth, fifth etc.
D.G. Wright is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.