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.

Blog Module

Discuss the Blog Module.

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

Blog entries on main homepage.


23 Posts   6244 Views


3 June 2009 at 7:53am Community Member, 68 Posts

woohoo, it will be probably my first helping opportunity !

check my post which solved your problem here:

i hope this helps!


4 June 2009 at 8:29am Community Member, 41 Posts



16 July 2009 at 12:16am (Last edited: 16 July 2009 12:23am), Community Member, 6 Posts

Hi all,

I'm currently evaluating SS against Modx and I've been trying to display the latest 4/5 blog posts in the side bar of the main template and found this thread. Using Fuzz10's code, what where and how do you paste this, i seem to be able to figure this stuff out in Modx but not in SS, but the blog module is so good i don't want to give up. Im uisng the blackcandy template and have the blog module installed

Any help appreciated.


16 July 2009 at 12:27am Community Member, 787 Posts

The example code needs to be placed in its own method in the relevant page-controller class. Then , the code can be called from your template.

I advise going through the tutorials on this site to get a feel for the core principles of Silverstripe and the MVC pattern.

good luck !


16 July 2009 at 1:07am Community Member, 6 Posts

Thanks Fuzz10,

Firstly great site you have (im assuming it's SS powered), i see you have the latest blog/news display that im trying to acheive, so if anyone is capable of giving advice on this it would be you, so i do appreciate your taking the time to reply.

That said, i find myself getting quite frustrated with the tutorials as they seem to be targetted at programmers or certainly the more code programmer orientated. I seem to be able to acheive results a lot quicker in Modx and im getting frustrated at that too, because for some reason i think i want to work with SS when all logic says use Modx.

MrHyde has a great post, but does not seem to work for me, i know it's cheeky but if someone has a paste this into this and do that mini guide it would be very helpful and certainly make the tutorials easier to understand when i cross reference what i did with the tutorial as even after 3-4 hours of reading and re-reading them, it seems very hard to apply them to the base install.

Is it just me or do others struggle with this first time round?


16 July 2009 at 1:22am (Last edited: 16 July 2009 1:23am), Community Member, 787 Posts

Thanks for the compliment. ;)

Well, I agree that starting out with Silverstripe is a lot easier for coders because of the chosen (IMHO beautiful) architecture. Believe me, it is well worth the initial effort.

As to your question ; basically :

1> Add to your HomePage_Controller class :

   function MyBlogEntries($limit = 10) {
      $BlogEntries = DataObject::get_one("BlogHolder");
      return ($BlogEntries) ? DataObject::get("BlogEntry", "ParentID = $BlogEntries->ID", "Date DESC", "", $limit) : false;

2> In you homepage template :

<% control MyBlogEntries %>            
$Title , $Link $Summary or whatever blog-fields / methods you would like to use.

or , try <% include BlogSummary %> , don't know whether or not this still works with the most recent version of the blog-module though
<% end_control %>

Et voila...


16 July 2009 at 1:46am Community Member, 6 Posts

See, it makes so much more sense when it's explained person to person, thank you so much Fuzz10. This is much more like im used to, but this is not made clear in the tutorials. Im not going to complain because you've now made me very happy.

I'll be quite honest Fuzz10 it was your site and perhaps one other than made me decide to try SS in the first place. Im always worried about using CMS because of the idea that it may take away design freedom, clearly thats not the case :)

Im trying to bunch together the database references, to display Tags (or the frist 2 or three), i've managed to get the references for author and commetns count from the BlogEntry and summary files, but Tags i cant seem to get to work

So far i have:



16 July 2009 at 7:40pm Community Member, 787 Posts

Sleeper :

For all fields / variables and methods you can use , have a look at the templates that came with the blog-module , especially the ...

To display Tags :
<% control TagsCollection %>
<a href="$Link" title="View all posts tagged '$Tag'" rel="tag">$Tag</a><% if Last %><% else %>,<% end_if %>
<% end_control %>