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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

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


Go to End


5 Posts   1386 Views

Avatar
ginger

Community Member, 9 Posts

24 August 2009 at 8:03am

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

Community Member, 126 Posts

24 August 2009 at 8:14am

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

Community Member, 9 Posts

24 August 2009 at 4:39pm

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

Community Member, 126 Posts

24 August 2009 at 8:13pm

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

Community Member, 9 Posts

25 August 2009 at 4:27am

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