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:

General Questions /

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

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

Change Pagination number


Go to End


3 Posts   506 Views

Avatar
Bagzli

Community Member, 71 Posts

30 January 2014 at 4:19pm

Hey guys,

I've tried following this tutorial to get pagination working: http://doc.silverstripe.com/framework/en/howto/pagination

I've managed to get it to work and it defaults to 10 results per page, however I cannot figure out how to change that number and set it to 3 or 5 or whatever I need. I'm not sure what the code is nor where I would put it.

Anyone can help?

Avatar
martimiz

Forum Moderator, 1391 Posts

2 February 2014 at 2:54am

This should work:

	public function PaginatedPages() {
		return PaginatedList::create(Page::get(), $this->request)->setPageLength(3);
	}

Avatar
Bagzli

Community Member, 71 Posts

3 February 2014 at 4:07am

Edited: 03/02/2014 4:37am

Thank you, worked like a charm.