Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Move through page siblings

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1235 Views
  • Blackdog
    Avatar
    Community Member
    156 Posts

    Move through page siblings Link to this post

    Hello everyone,

    just working away on a site and it has controls for the user to move forward and back throgh the page siblings. I took a look at the sibling control posted in the doku but that will list all siblings.

    Is there any way to identify the current page and using that as the offset? This could allow for the query to be limited to 1 and the offset set to pickup the next/previous page only.

    cheers.

  • Blackdog
    Avatar
    Community Member
    156 Posts

    Re: Move through page siblings Link to this post

    Ok, probably the best thing to do is count the rows up until the item ID then use that as the offset. Right?

    $sqlQuery = new SQLQuery(
    "COUNT(ItemName.ID)",
    "ItemName WHERE ItemName.ID < ".$this->ID.""
    );

    echo $sqlQuery->execute()->value();

    1235 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.