I have a question.
there is a function "DraftNewsletters" in the newsletter/code/NewsletterType.php.
It returns all the draft newsletters.
I added a similar function to the NewsletterType.php:
function NewslettersArticles() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "Newsletter",
$filter = "",
$sort = "Created DESC",
$join = "",
$limit = "{$SQL_start},4"
);
return $doSet ? $doSet : false;
}
And I'm showing all the newsletters in my page like this:
<% control NewslettersArticles%>
<h3><a href="$Link" >$Title</a></h3>
<p class="entry-date"><strong>Date:</strong> $Created</p>
<% end_control %>
Everything works fine.
But I need to add a pager:
I'm using code from the tutorial:
<% if NewslettersArticles.MoreThanOnePage %>
<p>
<% if NewslettersArticles.PrevLink %>
<a href="$NewslettersArticles.PrevLink"><< Prev</a> |
<% end_if %>
<% control NewslettersArticles.Pages %>
<% if CurrentBool %>
<strong>$PageNum</strong>
<% else %>
<a href="$Link" title="Go to page $PageNum">$PageNum</a>
<% end_if %>
<% end_control %>
<% if NewslettersArticles.NextLink %>
| <a href="$NewslettersArticles.NextLink">Next >></a>
<% end_if %>
</p>
<% end_if %>
but it doesn't work.
NewslettersArticles.MoreThanOnePage does not return anything. Why??