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'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.

Template Questions /

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

Creating a holder of holders


Go to End


4 Posts   1585 Views

Avatar
Lime Blast

Community Member, 22 Posts

28 May 2013 at 11:26pm

I've been following the tutorials on building a silverstripe site, and have learnt about the convention of creating Holder pages (such as ArticleHolder in the tutorial) which is used to contain individual articles (ArticlePage), etc..

My question is, what is the convention if you want to create a holder of holders?

Following the tutorial's example, lets say I want multiple holders, each representing a different category, all of which I want listed under a main articles page.

So that rather than having a tree structure like this:

Articles (Article Holder)
|- Why I'm so great (ArticlePage)
|- Why other people are greater (ArticlePage)
|- Why do I have such an ego (ArticlePage)

I have one more like this

Articles (???)
|- All About Me (ArticleHolder)
| |- Why I'm so great (ArticlePage)
| |- Why other people are greater (ArticlePage)
| |- Why do I have such an ego (ArticlePage)
|- Activities (ArticleHolder)
| |- Why sports suck (ArticlePage)
| |- Why computer games rule (ArticlePage)

Is there a convention for the name of this upper page type? Do I have to name things as Holders, or would it be acceptable to name it something more relevent (such as CategoryPage, CategoryList, ...)

Thank you

Avatar
copernican

Community Member, 189 Posts

29 May 2013 at 12:03am

Hi Lime Blast,

I don't think there is really a naming convention for this structure, even the "*Holder" isn't really convention (as far as I know), just a nice, logical name for the page type. If I were you I would probably call my 2nd level holders "ArticleCategory" since as you said, they each represent a different category.

Avatar
Lime Blast

Community Member, 22 Posts

27 June 2013 at 9:49pm

Thank you :)

Avatar
goodness

Community Member, 38 Posts

17 July 2013 at 6:54am

It appears that the way you have it set in your 2nd example should work.

Assuming your Articles (???) page will be a page type that has ArticleHolder as children.
Then your ArticleHolder page types will accept the AtriclePage children to populate their content.

So:

Articles = Page Type that has children set to ArticleHolder (AtricleHolderHolder ?)
ArticleHolder = Page Type that has children set to ArticlePage
ArticlePage = Pages that are children (in Site Tree) of their perspective Parent ArticleHolder pages