Let's say I have a page that is a top-level item named "A" that uses "class A". Then that page has a child page named "B" which uses "class B". Then "B" has a child named "C" using "class C". Page "B" doesn't have it's own template because I don't want to show anything for "B", I only use this page to group "C" items together. Ideally I want the "A" template to just display a certain amount of "C" items regardless of it's "B" parent all ordered by creation date. And then if you were to go to a "C" template, then you can also see a select group of it's siblings and also be able to navigate back to "A", it's grandfather. So "B" is only for categorizing all my "C" items, I hope what I just wrote makes sense. I'm not sure there is a better method to grouping pages of a certain type while being able to dynamically create new groups. I'm having trouble with the data model and the relationships. Any help would be greatly appreciated.
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.
I think the easier solution for me would be to "hide" the "B" class from the front end. How would I do that? So "A" has the url http://example.com/pagetype_a, but if someone went to http://example.com/pagetype_a/pagetype_b they would get the page not found template. But, if they went to http://example.com/pagetype_a/pagetype_b/pagetype_c they would get the "C" template.
I think I would check the parent urlsegment in page b. If it is empty than display content from the 404 page.
You should also be able to call the 404 page directly, somehow.
In the navigation you could check for class b or check if it has children. If not than just display the children.
Something like:
<% control Children %>
<% if ClassName ClassB %>
<% else %>
ClassB: $Link
<% end_if %>
<% control Children %>
ClassC: $Link
<% end_control %>
<% end_control %>