Say I have a "ProjectsHolder" page type, and its children are only of type "ProjectPage". From within "ProjectPage" is there an easy way to get the next and previous pages from the children of "ProjectsHolder" ?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
If you know what you're ordering them by then yes. Not sure exactly how you want to do it but if you're using the Sort column from SiteTree then you can write your own function in ProjectPage that fetches the next page in the sequence.
For example
function NextProject() {
return DataObject::get_one("ProjectPage", "Sort = ".($this->Sort+1));
}
Now if you have several project holders you need to add the ParentId as well but that should be the gist of it. In the template for a ProjectPage you can now write NextProject.Link to get the page link.