21308 Posts in 5737 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 591 Views |
-
Next and Previous page links

5 August 2011 at 3:57am
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" ?
-
Re: Next and Previous page links

5 August 2011 at 5:31am
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.
| 591 Views | ||
|
Page:
1
|
Go to Top |

