Skip to content

Instantly share code, notes, and snippets.

@mediabeastnz
mediabeastnz / silverstripe-prev-next.php
Last active March 11, 2021 13:07
SilverStripe Prev / Next Controls
public function PrevNextPage($Mode = 'next') {
if($Mode == 'next'){
return SiteTree::get()->filter(array("ParentID" => $this->ParentID, "Sort:GreaterThan" => $this->Sort))->sort("Sort ASC")->limit(1)->first();
}
elseif($Mode == 'prev'){
return SiteTree::get()->filter(array("ParentID" => $this->ParentID, "Sort:LessThan" => $this->Sort))->sort("Sort DESC")->limit(1)->first();
}
else{
return false;
/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
.animated {
/*CSS transitions*/
-o-transition-property: none !important;
-moz-transition-property: none !important;
-ms-transition-property: none !important;
-webkit-transition-property: none !important;
transition-property: none !important;
/*CSS transforms*/
@benjamin-smith
benjamin-smith / PrevNextPage
Last active March 19, 2018 15:59
Custom Pagination in SilverStripe CMS
<?php
class CustomObject extends DataObject {
private static $db = array(
'Sort' => 'Int',
);
private static $default_sort = 'Sort ASC';