Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Latest forum topics

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 851 Views
  • grilldan
    Community Member
    135 Posts

    Latest forum topics Link to this post

    What I am trying to do is to get the last 5 forum topics, and the first 80characters of their topic text.

          <% if InSection(home) %>
           <div id="last_topics">
             <!-- get last topics-->
       <% if LatestPosts %>
                <% control LatestPosts(5) %>
                      <h2>Latest Questions</h2>
                <% end_control %>
             <% else %>
                <h2>No Latest Questions</h2>
                <h3>No Title</h3>
                <p>No content</p>
             <% end_if %>
          <% end_if %>

    I'm guessing something like that, but that code doesn't work.


    I got it working, now I'm trying to take out the bbcode, or parse it.

    I was working with this code to try to get it to parse.

          $this->content = DataObject::get('Post', '', 'Created DESC', '', (int)$limit);
          $this->content = (string)$this->content;
          $parser = new SSHTMLBBCodeParser();
          echo $parser->getParsed();

    Found what I needed here. Parse the code in the .ss file

  • Nivanka
    Community Member
    395 Posts

    Re: Latest forum topics Link to this post

    This is not difficult,
    Just see the codes of the Latest Forum Post Widget

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.