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   1544 Views

Avatar
redking

43 Posts

28 May 2008 at 8:50am

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

Forum Moderator, 922 Posts

28 May 2008 at 10:01am

Edited: 28/05/2008 10:01am

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

43 Posts

28 May 2008 at 10:43am

Edited: 28/05/2008 10:43am

Worked. Right on! Thanks, man :)