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.

Template Questions /

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

Show first child on homepage


Go to End


2 Posts   1322 Views

Avatar
DanStephenson

Community Member, 116 Posts

23 November 2014 at 4:50pm

Hello,

I am building a site for a client who is going to be running his own web comic. I currently have the site setup so that each series of comic panels he enters are a datatype called "Series". These will all be child pages of the homepage.

What I'd like to do is set the homepage up so it always shows the contents of the latest Series (latest being at the top of the list in page order). How can I do this in SilverStripe?

Avatar
probablytony

Community Member, 4 Posts

25 November 2014 at 11:27pm

Edited: 25/11/2014 11:32pm

If I understand your question correctly, it would be something like this:

<% loop Children %>
<% with Series.First %>
<img src='$Image.URL' alt='$Image.Title' />
<% end_with %>
<% end_loop %>