Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Extending DataObjectSet by FirstPageLink, LastPageLink

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 914 Views
  • rainerh
    Community Member
    23 Posts

    Extending DataObjectSet by FirstPageLink, LastPageLink Link to this post


    is it possible to extend DataObjectSet by two functions that returns the link for the first respectively the last page? I tried to decorate it by an extension object. Unfortunately the extension object cannot access the $pageSize or $paginationGetVar fields (because they are protected????).
    It should be very simpe though. Just add:

    * Returns the URL of the first page.
    * @return string
    public function FirstLink() {
    if($this->pageStart > 1) {
    return HTTP::setGetVar($this->paginationGetVar, 0);

    * Returns the URL of the last page.
    * @return string
    public function LastLink() {
    if($this->pageStart + $this->pageLength < $this->totalSize) {
    return HTTP::setGetVar($this->paginationGetVar, ($this->TotalPages() - 1) * $this->pageLength);

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.