Blocks

Let's first of all talk about regions.  A page is divided into regions such as header, footer, left sidebar, right sidebar and content.  The main content of a page is usually placed in the content region and sidebars typically have navigation but you can put anything into regions.

Blocks are usually small pieces of content that perform a specific function.  On the left you can see the navigation block.  Any regions that are empty simply do not appear and we can put more than one block in a region.

  1. Go to: Site building > blocks
  2. Choose a block you wish to enable and assign it to a region

You can assign a block to a region either by draging it or by changing the region drop down. You will also see that you can alter the order of blocks that appear in the same region.

You will now find that your block appears on all pages which you may not want and there are various options for setting when a block should appear.

  1. Click configure next to the block you want to edit
  2. Scroll down to Role specific visibility settings and set them as you wish
  3. Scroll down to Page specific visibility settings

For page specific visibility settings you can set the block to be shown or hidden on specific paths.  You can use constructs such as:

  • node/64 - To show/hide a block on a node irrespective of its url alias
  • content* - To show/hide a block on any urls that start with 'content' e.g. content/my-tutorial
  • <front> - To show/hide a block on the homepage

There is also a setting for php mode .  Please let me know if you want to know more about this.

It is a good idea to set your content types to use specific url patterns and then you can set your blocks to appear only on those content types. 

  1. Go to: Site building > Url aliases > Automatic alias settings
  2. Scroll down to Node path settings
  3. Copy the default pattern and edit it in the content type you wish to change
  4. There are more pattern replacement options shown under Replacement patterns