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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Latest forum topics

Go to End

2 Posts   1082 Views


Community Member, 135 Posts

29 September 2008 at 5:12pm

Edited: 29/09/2008 7:40pm

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 :)


Community Member, 400 Posts

29 September 2008 at 10:39pm

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