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.
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.
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?
Thanks for your help..
I wasn't controlling the children. I got it working by adding that.
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?
this should help: http://doc.silverstripe.org/datamodel#querying_data