Silverstripe: I have a blog on my page with muliple pages, and 10 entries per page. I want my controller to know which page of the blog is currently being viewed.
I have the following code:
public function dependsOnPage() {
$page = getPageHere; /*How can I get which page of the blog I'm currently on?*/
$i = ($page*10)-10;
echo $i;
}
The URL on the second page would look like this for example: ?start=10 On the third like this ?start=20
Does anyone know how I can do this in Silverstripe?
I tried:
//echo SiteTree::get_by_link('news')->Link();
//echo (Director::urlParam());
//echo Director::getCurentPage();
echo Director::get_current_page();
echo Director::baseURL();
$test = $_GET['url'];
echo $test;
echo $this->request->param('ID');
// echo Director::absoluteURL('', false);
//echo $this->getCurentPage();
//echo $this->request->param() ;
//echo $this->URLSegment;
//echo Director::absoluteBaseURL();
//echo $this->param();
//echo $this->getURLParams();
//echo SS_HTTPRequest->param();
Solution:
$urlParam = Controller::curr()->getRequest()->getVar('start');