mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Use Injector for creating paginated list of blog posts
This commit is contained in:
parent
2da2c2927f
commit
0a8235615d
@ -1031,7 +1031,7 @@ class Blog_Controller extends Page_Controller
|
||||
{
|
||||
$allPosts = $this->blogPosts ?: new ArrayList();
|
||||
|
||||
$posts = new PaginatedList($allPosts);
|
||||
$posts = PaginatedList::create($allPosts);
|
||||
|
||||
// Set appropriate page size
|
||||
if ($this->PostsPerPage > 0) {
|
||||
@ -1049,13 +1049,13 @@ class Blog_Controller extends Page_Controller
|
||||
|
||||
return $posts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the absolute link to the next page for use in the page meta tags. This helps search engines
|
||||
* find the pagination and index all pages properly.
|
||||
*
|
||||
*
|
||||
* @example "<% if $PaginationAbsoluteNextLink %><link rel="next" href="$PaginationAbsoluteNextLink"><% end_if %>"
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function PaginationAbsoluteNextLink() {
|
||||
@ -1068,7 +1068,7 @@ class Blog_Controller extends Page_Controller
|
||||
/**
|
||||
* Returns the absolute link to the previous page for use in the page meta tags. This helps search engines
|
||||
* find the pagination and index all pages properly.
|
||||
*
|
||||
*
|
||||
* @example "<% if $PaginationAbsolutePrevLink %><link rel="prev" href="$PaginationAbsolutePrevLink"><% end_if %>"
|
||||
*
|
||||
* @return string
|
||||
@ -1079,7 +1079,7 @@ class Blog_Controller extends Page_Controller
|
||||
return Director::absoluteURL($posts->PrevLink());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays an RSS feed of blog posts.
|
||||
*
|
||||
@ -1164,5 +1164,5 @@ class Blog_Controller extends Page_Controller
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user