Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba

newsletter module


Go to End
Reply


793 Views

Avatar
NtM

Community Member, 39 Posts

24 November 2009 at 11:56am

Edited: 24/11/2009 1:10pm

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">&lt;&lt; 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 &gt;&gt;</a>
<% end_if %>
</p>
<% end_if %>

but it doesn't work.

NewslettersArticles.MoreThanOnePage does not return anything. Why??