A page head for each section

I'm new to SilverStripe, but so far I like it very much. I now have a development problem which I don't know quite how to solve (unfortunately the SS documentation seems to be far from complete).

I have a site with six "sections" = six pages on Level 1 in the site structure. I want a distinct page head for each section, which would be inherited by the sub-pages of each respective section. For ease of maintenance I would like not having to create six different page types; I would rather have one page head which detects the section and replaces the shown contents accordingly.

I tried using $URLSegment as body id and showing only the correct head by means of css. This worked fine on the top level, but as each sub-page get their own url this solution was not practical. I have also tried experimenting with Level(1) etc. but found no workable solution.

Does anyone have a suggestion for a nice solution? I should also add that I am no programming genious -- I have dabbled in various simpler programming for a decade or two, but much of it is really over my head.

now, in you Page_Controller class, define a function to retrieve the header value in templates:

function header() {
if($this->header == 'inherit') {
//some recursive function moving up the sitetree to detect the first page having header != 'inherit' and returning it
//can't figure out the exact code for now... you might also like to leave this on out and just set 'header' on every page...
} else {
return $this->header;
}
}

There is a simpler way to do this. In your Page.php define whichever database fields you want for your header, in this example well just use a header image, but you can extend this as far as you need to.

The key to this is the if(!$this->Parent) which is checking that the page has no parents (i.e. is a root page) and if it is it adds the header field.

The only problem with this method is that pages which do not extend 'Page' wont have the header field, an example of this is the Redirector page. You can get around this by extending the Redirector page and adding in the above code, or adding it to the origonal redirector page or even easier just set a fallback image for pages which don't have the header field.

you're completely right, aram, using <% Level(1) %> is the solution replacing my clumsy 'recursive function' approach.
just wanted to mention, the post py 'Mans' didn't clearly mention it's all about a simple image - in case it's more a piece of html, the mentioned way of using css classes (or alternatively, using an HTMLText field) may do the trick.

Thanks a lot for the help, guys! It's great to know that there is so much knowledge in these forums. Turns out I went with the multiple PageType solution after all -- there is indeed more than an image in each head, and it tended to get a little too complex (for me) using other solutions.