I have created a paging system for my site that manifests as a 'Next' and 'Previous' button at the bottom of the page. It works by matching the digits in the current URL, and then printing the HTML of the NEXT and PREV buttons with the href pointing to the new URL which is the same as the current URL but with the number being one greater or one lesser. So if my URL is http://www.site.com/services/page/05/ then the hrefs in the buttons will be http://www.site.com/services/page/04/ and http://www.site.com/services/page/06/ respectively.
The thing is, if there is no 'next' page (as if we were at the end) or if there is no 'prev' page as if we are at the beginning, then the buttons must not display. So I created a conditional statement for each print command so that if the next or previous page in the list does not exist, it does not print the HTML.
The list is an array of names of .html files in a directory. I create this list by scanning the directory and doing a PREG match to establish which directory contains the pages and which files are eligible to be pages (because not all addresses in that directory are suitable to be pages like '.' and '..'). By using this method I can make this whole thing a function and put the buttons in different parts of the website, and then in each different case I can specify what directory contains the files, what the files all look like (the PREG pattern) and how the new URLs must be printed inside the NEXT and PREV button links.
OK great, so when I moved this system from my MAMP development environment to my client's live host, it didn't work because of a security restriction. So what should I do as an alternative? Thanks