Hi all,
I'm attempting to output some pagination for more than one page type. My function gets all the data as expected, but ".MoreThanOnePage" returns false. I followed the [url=http://doc.silverstripe.org/doku.php?id=private:recipes:paginationguide in the wiki and it works for one page type, but not in this instance.
Here's what I have in my page controller:
function LatestNews($pageLimit=2) {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$articles = DataObject::get("Page", "`ClassName` IN ('DocPage', 'TechDocPage')");
$returnarticles = $articles->getRange($SQL_start, $pageLimit);
return $returnarticles;
}
And in my template I have the controller returning the page data as it should, but there is never any output for the pagination:
<% control LatestNews %>
<p>$DateAdded.Format(j F Y)</p>
<p>$Content.FirstParagraph</p>
<% end_control %>
.
.
.
<% if LatestNews.MoreThanOnePage %>
<% if LatestNews.PrevLink %>
<a href="$LatestNews.PrevLink"><< Prev</a> |
<% end_if %>
<% control LatestNews.Pages %>
<% if CurrentBool %>
<strong>$PageNum</strong>
<% else %>
<a href="$Link" title="Go to page $PageNum">$PageNum</a>
<% end_if %>
<% end_control %>
<% if LatestNews.NextLink %>
| <a href="$LatestNews.NextLink">Next >></a>
<% end_if %>
<% end_if %>
I must be missing something in my data object call?