Hi,
I am on a Grandchild level looping through my Grandparents, and I need to look at the URL's of each of them and treat one of them differently as I write them to the page. I do not know where to put the function that returns whether the URL is a certain one. Here is my structure:
Experience (ExperienceHolder, URL = "experience")
>>>News (NewHolder)
>>>>>>NewsPage
>>>Item 2
>>>Item 3
>>>Item 4
I am in the NewsPage template, using <% control ChildrenOf(experience) %>, I am writing out News, Item 2, Item 3, Item 4, etc. Now, IF it is news, then I want to write something different. So in my control loop I have <% if IsCertainItem(URLSegment) %> logic, which I am sure will work. I just don't know WHERE to put this boolean function:
function IsNewsItem($url) {
if($url=="blah-blah-blah") {
return true;
}
return false;
}
Because I am looping through the Children of Experience, of which theer are several, so it is unclear. I tried putting the function in NewsPage, ExperienceHolder, AND NewsHolder, and it is still not being called.
Any help?? I run into this confusion a lot in SilverStripe-- not knowing WHERE to put my code.
Thanks in advance,
Garrett