# Child should inherit

**URL:** <https://www.ruby-forum.com/t/child-should-inherit/86333>\
**Category:** Radiant CMS\
**Created:** [February 21, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/child-should-inherit/86333 "2007-02-21T15:31:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Minor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@David\_Minor](https://www.ruby-forum.com/u/David_Minor)\
**Post date:** [February 21, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/child-should-inherit/86333/1 "2007-02-21T15:31:44Z")

</div>

maybe there is a way to do this that I’m not seeing, but I think it  
would be very useful to tell a parent what filter/layout/page type  
his children should be. As an example of this, I have a primary  
layout that is used for the Home Page and most pages inherit from  
that. Under the Articles (page type archive), the children should  
have a post layout instead of the primary one. Currently I have to  
set the page layout for each post. I’d like for a new child of the  
archive to know which layout it should use. Does this make sense or  
are there limitations in radiant that would keep this from being  
fulfilled?

dm

---

<div class="post-metadata">

**Author:** ![David\_Minor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@David\_Minor](https://www.ruby-forum.com/u/David_Minor)\
**Post date:** [February 21, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/child-should-inherit/86333/2 "2007-02-21T16:15:52Z")

</div>

On Feb 21, 2007, at 9:30 AM, David Minor wrote:

> maybe there is a way to do this that I’m not seeing, but I think it  
> would be very useful to tell a parent what filter/layout/page type  
> his children should be. As an example of this, I have a primary  
> layout that is used for the Home Page and most pages inherit from  
> that. Under the Articles (page type archive), the children should  
> have a post layout instead of the primary one. Currently I have to  
> set the page layout for each post. I’d like for a new child of the  
> archive to know which layout it should use.

I’m having the same problem and have resorted to using One Layout to  
Rule Them All – merged my two or three layouts into one big layout  
using if\_url/unless\_url – works fine and duplication really isn’t an  
issue using snippets. Not the best, but darn good; some other ideas  
I’ve had:

- I think it would be possible to have an extension create a  
“Children’s Default Layout:” dropdown

- Another related solution is a “shortcuts” extension I’m working  
on, which adds “New Blog Post”-like links for user-defined commonly  
created page types. Each creates a new page w/ some options pre-  
defined and possibly immutable, e.g. parent page, filter, default  
parts, default page type, automatically created child pages

love to hear others’ thoughts  
-jamie

---

<div class="post-metadata">

**Author:** ![David\_Minor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b38774/32.png) [@David\_Minor](https://www.ruby-forum.com/u/David_Minor)\
**Post date:** [February 21, 2007, 5:01pm UTC](https://www.ruby-forum.com/t/child-should-inherit/86333/3 "2007-02-21T17:01:03Z")

</div>

Jamie, I’m trying to solve the same problem with a different solution.

I’ve created what a “TemplatePage” type, and all page parts have a  
checkbox for “is\_template”.

You can then have quicklinks like you described “New Blog Post” that  
would create a new “ContentFromTemplatePage” using the “Blog Post”  
template page as it’s base. Only parts that are marked with  
“is\_template” will exist in the newly created page. If a part is  
referenced in the context of a ContentFromTemplatePage and it doesn’t  
exist on that page, then the TemplatePage is was created from will  
provide this part.

That way you can use the “body” part in your TemplatePage “Blog Post” to  
define the layout of the post.

And then have is\_template parts “teaser” and “extended” that contain  
just straight text content.

new “Blog Post” items will be created with a “teaser” and “extended”  
part (and no body). And when the layout refers to \<r:content  
part=“body”/\> it will pull the formated body part from the TemplatePage  
it was created from, and when that body refers to “teaser” and  
“extended” parts it will show the content you entered for your  
particular blog post?

Make sense?

This and a number of other things, like TinyMCE, FCKEditor, and pages  
attributes (which inherit in the same way that parts do from  
TemplatePage). Will be part of an upcoming extension currently being  
called the PageAttributes extension.

There’s only 1 catch.

I’m relying on changes I made to the facets branch which havn’t been  
accepted by the core devs yet.
