I was recently working on a website that required some of it’s content to be paginated. As I was about to start writing the code to build the links for the pagination, I thought instead of writing a piece of code that could only be used this once, it might be a good idea to write a function that was a bit more flexible. This way I would be able to write the code once and use it in future projects rather than having to write the same bit of code over and over again.
Since writing the code I have used it in a couple of different projects, and while it’s not perfect, it’s certainly a good start and has saved me tons of time already. Anyway, you can find the code and a quick usage example using the link below. The code itself is well commented and is very easy to use but if you have any issues or suggestions, feel free to get in touch or leave a comment below!