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.

Archive

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

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

Blog Entry on Homepage


Reply

3 Posts   1528 Views

Avatar
redking

28 May 2008 at 8:50am 43 Posts

Hi,

Does anyone know how to make the most recent entry from the blog module display on the homepage. I had done this with the new section before, but can't seem to figure out how to do it with the blog. Any ideas?

Thanks!

Avatar
Sean

28 May 2008 at 10:01am (Last edited: 28 May 2008 10:01am), Forum Moderator, 921 Posts

Adding this function to your HomePage_Controller should work...

function getLatestPost() {
return DataObject::get_one('BlogEntry', '', false, 'LastEdited DESC');
}

Then you can call $LatestPost.Title and so forth in the template.

Avatar
redking

28 May 2008 at 10:43am (Last edited: 28 May 2008 10:43am), 43 Posts

Worked. Right on! Thanks, man :)