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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

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

blog titles


Go to End


3 Posts   1239 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.