Composition
N2 supports two major ways of defining the content on a page. Inheritance and composition. Inheritance means that a page is a kind of something while compositoin means that the page has a certain property.
In the previous example we said that the news page is a kind of text page. Lets say we want to create a teaser on both these pages. The teaser has a text and a link and should be displayed as a nice little eye-catching box.
It would be easy enough to add two editables for the text and the link on the text page and it would immediatly be inherited on the news page as well.
Another option, that also has some other benefits, is creating a new item: the teaser item. This item isn't a page, it's a part that compose the text and news pages. This is how it could be defined (you also need to add a [Definition] attribute to the class):
The teaser's title can be edited and it has a target url property but what makes this item a part that compose another page? It's template url that referres to a user control and the IsPage property returns false.
There are two ways of adding this item to our text page, the first one is making an editable property:
Whenever we edit the page with this editable property we will also edit a teaser item that composes the page.
The other way of adding the teaser has an additional benefit; we can add more than one teaser. The second approach calls for the use of "zones" which are briefly mentioned on the page about integrity. First we make a zone available on the page:
...then we allow the teaser in the zones of the same name:
Thats it. Now we can add teasers to the right column through the edit interface, but there is another important aspect to consider before this is done: the presentation.