Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

How do I get the relative path minus the parameters?

Go to End

2 Posts   1483 Views


Community Member, 49 Posts

9 November 2008 at 11:03pm

Edited: 10/11/2008 10:55pm

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) {
			} else {
				$link = HTTP::setGetVar($this->pageNumGetVar, $i + 1);
			$thePage = new ArrayData(array(
					"PageNum" => $i+1,
					"Link" => $link,
					"CurrentBool" => ($this->CurrentPage() == $i+1)?true:false,

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


Community Member, 49 Posts

10 November 2008 at 8:47am

Is there a method already available to do this?