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
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.
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.
That worked perfectly! Thanks for the help, and I will check out the tutorial.