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:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Multiply News Holders


Go to End


5 Posts   1348 Views

Avatar
merme

Community Member, 2 Posts

17 September 2010 at 8:46pm

Edited: 20/09/2010 8:07pm

I need to create multiply news sections in to my site.

Is it possible to re-use the news holder only to display the news under that section?
Currently both of my newsholders are displaying all the news article from the whole site.

I haven't been able to find any answer from this forum.

I am using Silverstripe 2.3.5. Any piece of code would be much appriciated. Thanks for all help.

Avatar
Willr

Forum Moderator, 5523 Posts

19 September 2010 at 2:02pm

Edited: 20/09/2010 8:07pm

Yes its possible. Are you talking about the NewsHolders from the tutorial? In that case it should already be doing that. <% control Children %> will return just the children of the current news holder. If you have a custom call like DataObject::get("NewsArticle"); then you will need to filter that by ParentID.

Could you post your current newsholder code?

Avatar
merme

Community Member, 2 Posts

22 September 2010 at 9:22pm

Thanks for your help..
I wasn't controlling the children. I got it working by adding that.

Avatar
neilos

Community Member, 19 Posts

8 October 2010 at 11:52pm

I have a similar problem, except on my site I have a structure like;

NewsHolder > NewsHolder > Articles (displays nothing)

NewsHolder > Articles (works fine)

I can't get the Grandparent NewsHolder to display the GrandChildren Articles. Infact I can only get a blank white screen.

Anyone have this similar layout?

Avatar
ttyl

Community Member, 114 Posts

9 October 2010 at 3:05am