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:

Blog Module /

Discuss the Blog Module.

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

blog titles


Go to End


3 Posts   933 Views

Avatar
Remat457

Community Member, 2 Posts

30 July 2010 at 11:38am

Hi,
Does anybody have a simple way to display a set # (or pages, or all) of the titles in a blog? Like a TOC or index?
thanks

Avatar
Willr

Forum Moderator, 5523 Posts

30 July 2010 at 3:22pm

To get a list of pages you should use DataObject::get(). See tutorial 2 for an explanation of DataObject::get(). In your case you can put a function like this in your page.php

function AllBlogPages() {
return DataObject::get('BlogEntry');
}

Then you can use <% control AllBlogPages %>$Title<% end_control %> in your template to get a list of titles.

Avatar
Remat457

Community Member, 2 Posts

31 July 2010 at 5:40pm

That worked perfectly! Thanks for the help, and I will check out the tutorial.