Setting Up Sections

1. Create a new Taxonomy list to hold the names of the various sections of your website. Do this at Admin → Structure → Taxonomy → Add vocabulary. I called my taxonomy list 'Section' and the associated field is named 'field_section'. Add terms to the list for the names of sections that will apply to content nodes, such as News, Events or Office. Don't worry about listing sections for summary pages that will be generated by Views, such as Calendar or Event List. We will take care of those another way.

2. Add the Section field to each Content Type that you want be able to place in different sections of your site, such as Articles or Basic Pages. Go to Admin → Structure → Content types → manage fields. At the bottom of the list, click on 'Add existing field' and look for 'Term reference: field_section (Section)', or whatever name you chose for your taxonomy field. Under Label, give it a name such as 'Section', and select a widget to use – the select list works well since you will place each node in only one section at a time. Click Save and Drupal will bring up the configuration dialog for your new field. Make this field required and set it to allow only one value.

3. Now, build a directory tree in your sites 'files' directory. Inside of 'files' make a new directory named 'background'. Inside of that make directories for each of the sections of your site. Be careful to spell them the same as you did in the taxonomy list. Also, make a directory here named 'default'. Now, inside of each of the section directories and the default directory, make sub-directories for each of the image types that you want to change according to section. Mine are called header, matte and banner.

4. Make a few images to place in your sub-directories. You will want to have them sized properly to replace the image your theme is using now. For example, my header images are 960 by 150 px. If there is more than one image in a sub-directory, the function we add next will choose one at random to display each time the page is re-loaded. One of the images inside the default directory should be named 'default.jpg'. Any of the sub-directories left empty will use the default image instead, so it needs to be there.

So, it should look something like this:

 site/files--| 
    background--| 
        default--| 
            header 
                default.jpg 
            matte 
                default.jpg 
            banner 
                default.jpg 
        Youth--| 
            header 
                playing.jpg 
            matte 
            banner 
        News--| 
            header 
            matte 
                newsection.jpg 
            banner 
        Events--| 
            header 
            matte 
            banner

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.