0

I need to show channel entries in the form of a grid. The grid has four columns and five rows. Therefore I show the first 20 entries. I need to use pagination to show the next 20 entries. I am not able to think of how to accomplish this. Any help would be much appreciated.

4
  • 1
    use modulus operator to split entries by columns/rows and then use pagination. Or use channel:entries offset parameter to get next 20 entries.
    – Max Lazar
    Jun 4, 2014 at 6:26
  • Why would the normal pagination parameter on an exp:channel:entries tag pair not do exactly this?
    – foamcow
    Jun 4, 2014 at 13:14
  • I would have loved to do it, just that I am extremely new to expressionengine and I am trying to learn as I go. An example to show the same would be of much help to me. Thanks
    – user3059
    Jun 5, 2014 at 10:03
  • The requirement is such that there is a chosen template (Candidates - themeforest) which provides a 3 column template in divs. I need to figure out how to get the channel entries in those columns. Also, I dont want to use entry id since this is a blog in a grid view, and someone could have deleted a blog entry. it can tend to leave empty spaces if a particular id isn't found.
    – user3059
    Jun 5, 2014 at 10:12

1 Answer 1

1

This is a use for the paginate parameter on the channel:entries tag

As a very simple example...

... start the table ...
{exp:channel:entries channel="foo" paginate="bottom" limit="20"}
    <tr>
        <td>{title}</td><td>{another_field}</td><td>{yet_another_field}</td
    </tr>
    {paginate}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}
{/exp:channel:entries}
... close the table ...

EE will show a maximum of 20 rows and handle all the pagination for you

EDIT: From re-reading the question I see that you would be showing more than 1 entry per "row". Hence the answer referencing the modulus calculations.

Another way you might want to do it is to forgo the table completely (is a table the most appropriate element?) and use another HTML element that you can float across the page.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.