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.

Template Questions

How to Make a Page a Sub-Page of More than One Parent Page?


Reply

5 Posts   1128 Views

Avatar
ginger

24 August 2009 at 8:03am Community Member, 9 Posts

I'm working on an encyclopedia-type of project and need some pages to be listed under more than one category. Is there a way to designate a page as a sub-page of more than one parent page?

Avatar
schellmax

24 August 2009 at 8:14am Community Member, 126 Posts

the silverstripe database structure won't allow more than one parent id for a page, but there are other possibilities:
- use 'VirtualPage' in the sitetree (i was having problems with this one in previous silverstripe versions, can't say wheter it's doing fine now)
- refactor your code using dataobjects (see the tutorials on this or just post here again in case you need further advice)
hth

Avatar
ginger

24 August 2009 at 4:39pm Community Member, 9 Posts

Thanks, I definitely need more advice. I haven't read the tutorial on dataobjects yet but I will.

How does the VirtualPage work for what I want to do?

Avatar
schellmax

24 August 2009 at 8:13pm Community Member, 126 Posts

i suppose you're using 'category' pages, such as 'food' and 'fruit'.
so for a page called 'apple', you might first create the page in the sitetree as a child of 'food', then you could switch to 'fruit' and create a virtualpage there, pointing to the 'apple' page created under 'food'. :-)

as for the dataobject approach, you should work through tutorial 5, but make sure you're already familiar with the concepts explained in the previous tutorials (except tutorial 4 maybe).

Avatar
ginger

25 August 2009 at 4:27am Community Member, 9 Posts

Hey, that's great. The VirtualPage option seems to be just fine. One question - will it create issues of duplicate content in search engines?