ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Limit entries to X number of entries with pagination X pages

August 31, 2012 8:18pm

Subscribe [2]
  • #1 / Aug 31, 2012 8:18pm

    Elliot Lewis

    49 posts

    Pretty much all in the title!

    Is it possible to return a set number of entries, eg 50 and have them paginated to 10 per page?

    limit="10" paginate="top"

    Returns pagination for all entires in the channel.

    limit="10"

    Without pagination creates 1 page of results but with no way to get to the next 40 results.

  • #2 / Sep 04, 2012 11:12am

    Lisa Wess

    20502 posts

    Hi, Elliot,

    The limit will just limit the number of items shown - but the pagination will always, currently, show all the pages - you can’t limit the pagination output amount.  There may be an option on Devot-ee for an add-on for this, and it would make a great feature request as well.  Here are the pagination add-ons on Devot-ee.

  • #3 / Sep 07, 2012 4:38am

    Elliot Lewis

    49 posts

    It’s one of those awkward ones where the client thinks it’s a simple request. To be honest as it’s very simple in SQL I thought it would be!
    Thanks for the link to Devot-ee but I’d looked there. The closest I can get is perhaps by using Michael Byström Pagination http://devot-ee.com/add-ons/pagination as a basis for a custom extension.

    In this case I know that the entry total will always have more entries than I want to show so I’m going to hard code the pagination links, eg /P10 /P20 etc

    But yeah this would be a good feature to have. I can’t be the only dev that’s had this requirement (but then I always say that!)

    EDIT:
    Thanks Lisa, have posted request: http://ellislab.com/forums/viewthread/223878/

  • #4 / Sep 07, 2012 7:18am

    Warble Media

    14 posts

    You mentioned this would be easy to do with SQL, so I don’t see why this isn’t something you could do with the query module (disclaimer: I haven’t tested this).

    E.g.

    {exp:query limit="10" sql="SELECT ... LIMIT 50"}
        {!-- Your exp:channel:entries code… --}
    {/exp:query}
  • #5 / Sep 07, 2012 7:30am

    Elliot Lewis

    49 posts

    That was my initial thought. But the SQL would have to replicate all of what the weblog/channels module does. Categories, Member data etc. It’s not really practical. At least the pagination should work using the Query module!

  • #6 / Sep 07, 2012 7:32am

    Warble Media

    14 posts

    It would be one hefty SQL statement no doubt. As you said, this may only be useful for generating only the pagination or if you didn’t need categories/custom fields.

  • #7 / Sep 10, 2012 11:13am

    Lisa Wess

    20502 posts

    I saw you posted the feature request.  Thank you!

    I’m going to move this on down to community help in case there are other ideas for it.  😊

  • #8 / Sep 10, 2012 12:57pm

    Elliot Lewis

    49 posts

    Thanks Lisa. As an update, to see this ‘in action’ here’s the What’s New section:
    http://www.glassworks-studios.com/just-in/

    The pagination doesn’t come from EE, I’ve hard coded the links. So I’ve got a solution but it feels a bit kludgey. This FR would require adding new functionality to the Channel module, I can’t see how a hook would solve this?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases