#241 new
Alex Suraci

Use the in-line paginate constructs instead of generating them in the controllers

Reported by Alex Suraci | October 19th, 2008 @ 01:19 PM | in 2.1

From (pseudocode):


function index() {
    $posts = new Paginator(Post::find(array("placeholders" => true), $config->posts_per_page);
}

// ..., template:
// {% for post in posts.paginated %}
// blah
// {% endfor %}
// $posts.prev_link $posts.next_link

To:


function index() {
    $posts = Post::find(array("placeholders" => true));
}

// ..., template:
// {% paginate post in site.posts_per_page posts as posts %}
// blah
// {% endpaginate %}
// $posts.prev_link $posts.next_link

Comments and changes to this ticket

  • Alex Suraci

    Alex Suraci October 19th, 2008 @ 01:22 PM

    Drawback: Putting prev/next links above the posts would be slightly awkward.

    
    {% paginate post in 25 posts as posts %}
    {% if loop.first %}
    $posts.prev_link $posts.next_link
    {% endif %}
    blah
    {% endpaginate %}
    
  • misterbrandt

    misterbrandt October 19th, 2008 @ 02:57 PM

    I don't like forcing users to have to know how to edit theme files to make such a simple change. Seems like step in the wrong direction to me

  • Alex Suraci

    Alex Suraci October 19th, 2008 @ 03:11 PM

    Good point.

    We could just have both. The comments module does this now:

    
    {% paginate comment in site.comments_per_page post.comments as comments %}
    {# comments stuff #}
    {% endpaginate %}
    
  • Alex Suraci

    Alex Suraci October 25th, 2008 @ 03:27 PM

    • → Title changed from “Remove "xxxxxs_per_page" settings in favor of the in-line paginate constructs” to “Use the in-line paginate constructs instead of generating them in the controllers”

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket