Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How do I get the relative path minus the parameters?

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: 1070 Views
  • Hammy
    Avatar
    Community Member
    49 Posts

    How do I get the relative path minus the parameters? Link to this post

    I'm adjusting the way the pagination works in silverstripe, so to avoid duplication of the first page I am trying to get the relative path minus the parameters.

    So instead of $link pointing to /products/?page=1 (or using the default pagination in silverstripe /products/?start=0) when clicking on the link back the first page in the list, i want to simply provide $link with /products/.

    The code that I am using is as follows:

          ....
          for($i=$startPage; $i < $endPage; $i++){
             if($i == 0) {
                $link = WHAT SHOULD THIS BE
             } else {
                $link = HTTP::setGetVar($this->pageNumGetVar, $i + 1);
             }
             $thePage = new ArrayData(array(
                   "PageNum" => $i+1,
                   "Link" => $link,
                   "CurrentBool" => ($this->CurrentPage() == $i+1)?true:false,
                   )
             );
             $ret->push($thePage);
          }
          ....

    Can someone please help with "WHAT SHOULD THIS BE" in the snippet of code above?

  • Hammy
    Avatar
    Community Member
    49 Posts

    Re: How do I get the relative path minus the parameters? Link to this post

    Is there a method already available to do this?

    1070 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.