I started using silverstripe 3 weeks ago.
I build a little news system and now I have a "problem", which I can't fix.
I have a NewsHolder.php which extends the Page class
class NewsHolder extends Page
static $has_many = array (
'News' => 'News'
class NewsHolder_Controller extends Page_Controller
At the moment the content shows all news. But I want only 5 news and a link on the bottom of the page to view the next 5 news.
I wrote a function which I put in the NewsHolder_Controller:
function getNews ()
if (!isset($this->urlParams['ID']) || $this->urlParams['ID'] == 0)
$start = 0;
$start = $this->urlParams['ID']*10;
$news = DataObject::get("News",'','','',array($start,10));
Now I dont know how to move forward? When I am load http://localhost/mypage/news/1 (mypage is the silverstripe base folder and news the page name which uses the newsholder), I the error page. I don't want to use http://localhost/mypage/news/getNews/1 to switch the news.
Can someone help me?