Posted by angusbeare
I needed a list of the latest blog posts on my site. I'm using the standard blog module which is great but lacks a module for latest posts. So I knocked up an XMP template to do it.
Hope you find it useful.
You will need to tweak the SQL, especially the DNN4 object qualifiers which will probably need to be removed. Note also the blog module table blog_blogs has a field called 'Public' which is a reserved word (bad practice). My guess is this will get changed so watch out for it if you upgrade.
<xmod:template>
<listdatasource commandtext="SELECT top 5 ble.PermaLink,ble.Title
FROM dnn4_blog_entries ble
INNER JOIN dnn4_blog_blogs bb on bb.Blogid = ble.Blogid
WHERE ble.Published = 1 AND bb.Portalid = 30 AND bb.[public] = 'True'
ORDER BY ble.AddedDate DESC" />
<headertemplate>
<ul>
</headertemplate>
<itemtemplate>
<li class="Normal"><strong><a href="[[PermaLink]]">[[Title]]</a></strong></li>
</itemtemplate>
<footertemplate>
</ul>
</footertemplate>
</xmod:template>