Accessing the pagination with vae();
  • I would like to manually create pagination links like the ones that are automatically created in the prev= and next= links.


    The markup would look like this:


    <v:php>
    function page($id) {
    return $pagination_value;
    }

    </v:php>



    <v:collection>
    <a href="/press-image/page/<v?= page($id) ?>">Click here for image $id. </a>
    </v:collection>


    I think a good starting point is to take the attributes of the collection that I am trying to emulate the pagination for:


    <v:collection path="press_images" id="press_collection" order="DESC(press/publication_date)" previous="previous" next="next" wrap="true" paginate="1">
    </v:collection>


    as a vae() function:


    $press_images = vae( "press_images", array( "order" => "DESC(press/publication_date)", "paginate" => "1", "wrap"=>"true" ) );


    but where do I go from there?

  • 10 Answers sorted by
  • Vote Up1Vote Down KevinKevin September 2010

    As you may have figured out -- there's nothing really magical going on with the next/previous links when you have a paginated collection. The page numbers just go in order. So, say you have a page called items.html with a tag in it using pagination. You can just browse to http://domain.vaesite.com/items/page/1 or http://domain.vaesite.com/items/page/4 and that will work.

    So you can set up your links to link that way.

    ((Note: This answer describes Vae behavior for new sites. If you want to follow these steps on an older Vae site, you may need to change an option in the Site tab > Optimization tab to disable pagination in the query string.))

  • Vote Up1Vote Down KevinKevin September 2010

    For the page you posted up about Press, it sounds to me like what you really want to use is Vae's Permalinks.

    Check out http://docs.vaeplatform.com/permalinks for more information.

  • Vote Up0Vote Down Scott September 2010

    Hey Michael - Did you hit a roadblock with the native Vae next/prev functionali

  • I have two pages that need to accomplish this. I was able to get the first one working
    http://rubykobo.verbsite.com/collections

    But the second page is structured slightly differently.
    http://rubykobo.verbsite.com/press

  • fyi, as you might have guessed, the prev() and next() functions can only use their default sorting.

  • Yes I did. You can't change the sorting.

  • yes

  • Vote Up0Vote Down KevinKevin September 2010

    Yes, the prev() and next() functions in VaeQL can only use the default sorting. So that everyone is on the same page, I'm talking about doing something like this:

    <v:a path="next()">Next</v:a>

  • Yes but how do you access what place an item is in the order so that the page number can be figured out in a function?

    The issue is that I need to have 'previous' and 'next' links that iterate throughout an entire collection in date order.

  • Vote Up0Vote Down KevinKevin September 2010

    Well, you know what the current page is because it's stored in the variable $page. So you can make the previous link go to $page-1 and the next link go to $page+1.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion