Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » newsletter module

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 666 Views
  • NtM
    Avatar
    Community Member
    39 Posts

    newsletter module Link to this post

    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??

    666 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.