Pagination is another cool feature included in EE. This allows me to add links on each page which appear after the limit (defined in the opening channel tag) has been exceeded. It means that with the limit in place I dont have to have hundreds of entries on one page. This saves space, loading time and just makes the whole site a bit smoother.

Like the categories code – in fact, even easier than the categories code, the code for pagination is simple, depending on how complicated you want to make it.

The code below highlighted in red is all I needed to add inside, just before the end of the {exp:channel:entries} tag pair.

paginate

This meant that the page would display: Page # of # pages – 1,2,3 etc. I assigned the class “paginate” so that I could add CSS rules to the pagination, to make sure that on an odd number of entries it doesn’t float around the page. The result is below:

pagination

I applied this to every page in my website that required pagination – home page, blog, category page etc. My site is now becoming more dynamic!

Advertisements