22855 Posts in 9971 Topics by 2805 members
|Go to End|
17 September 2010 at 8:46pm Last edited: 20 September 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.
19 September 2010 at 2:02pm Last edited: 20 September 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?
22 September 2010 at 9:22pm
Thanks for your help..
I wasn't controlling the children. I got it working by adding that.
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?
9 October 2010 at 3:05am
this should help: http://doc.silverstripe.org/datamodel#querying_data
|Go to Top|