21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 968 Views |
-
Children pages to inherit the page type of parent?

1 May 2009 at 10:18pm Last edited: 1 May 2009 10:19pm
How can I set the default page type of children pages to inherit the page type of the parent.
-
Re: Children pages to inherit the page type of parent?

4 May 2009 at 9:47am Last edited: 4 May 2009 9:48am
Not sure if I follow what you are asking entirely, but it sounds like $default_parent and $default_child are what you are after.
http://doc.silverstripe.org/doku.php?id=recipes:customising-the-hierarchy
Cheers
Aaron -
Re: Children pages to inherit the page type of parent?

5 May 2009 at 8:05pm
What I want is if I have a Products page with sub pages i.e.
Products
> Product 1
> Product 2I want "Product 1" and "Product 2" to inherit the page type of "Products" so that whenever I add in a new product it defaults to the correct page type rather than the "Page" type.
-
Re: Children pages to inherit the page type of parent?

5 May 2009 at 8:29pm
You can include this in any page class and it will restrict the children allowed to whatever is in the array:
static $allowed_children = array('ProductPage');
-
Re: Children pages to inherit the page type of parent?

5 May 2009 at 8:33pm
BBC, did you check the link I gave? The very first example shows how to do exactly what you want, using both mine and howard's suggestions in tandem.
Aaron
-
Re: Children pages to inherit the page type of parent?

5 May 2009 at 11:05pm
Thanks, I did look at the link but I was confused at first glance. Looking back I now have what I want, it was as you said.. the first part i.e.
static $allowed_children = array("BlogEntry");
static $default_child = "BlogEntry";
| 968 Views | ||
|
Page:
1
|
Go to Top |


