Working with blocks (content in regions)
Blocks are the boxes of content (such as "User Login" or "Who's online") that can be displayed in regions (such as footer or sidebar) on your page.
Blocks are made available to your site most commonly by enabling modules. Once created, a Block can be modified to adjust its appearance, shape, size and position - or which Website pages it appears on. For example, enabling the core Poll module makes the "Most Recent Polls" block available for you to place in a region. Also note that some modules provide multiple blocks when enabled, others may not define new blocks.
If you click "Configure Block" (Drupal 7) you can go ahead and edit the contents of the block, deal with the visibility settings and even change the placement of where it is on your theme.
Blocks are placed in regions via the Block Admin page Administer > Site building > Blocks (Drupal 6), Dashboard > Structure > Blocks (Drupal 7).
Your site's theme defines the regions available. Therefore, block placement in regions is done per theme on the Block Admin page. If you have more than one theme enabled on your site blocks can be placed differently for each theme.
The block management screen also provides checkboxes (depending on your version of Drupal and what modules you have enabled), as well as a configure link, which takes you to the configuration screen. The checkboxes and configuration page let you customize the visibility of the block. A block's visibility depends on:
- Whether it is Enabled and assigned to a region. Disabled blocks (blocks not assigned to any region in your theme) are never shown.
- The Throttle checkbox (if you have the Throttle module enabled). Throttled blocks are hidden during high server loads.
- Page-specific visibility settings. Individual blocks can be configured to only show/hide on certain pages. This can be a path like "about" for the [site-root]/about page, "about/*" where the asterisk is any path that starts with "about". An important exception is the frontpage: "<front>". You can also show/hide blocks based on the result of a PHP snippet.
- Custom visibility settings. Individual blocks can be configured so that users decide whether to show/hide certain blocks.
- Its function. Dynamic blocks (such as those defined by modules) may be empty on certain pages and will not be shown.
The block management screen also has an "Add block" link. This allows you to define a block containing content of your choice. Each administrator-defined block consists of a title, a description, and a body which can be as long as you wish; the Drupal engine will render the content of the block.
- enable, throttle, place, and configure blocks at Administer >> Site building >> Blocks (Drupal 6) or Dashboard >> Structure >> Blocks (Drupal 7).
- add a block at Administer >> Site building >> Blocks >> Add block (Drupal 6), Dashboard >> Structure >> Blocks >> Add (Drupal 7).
If the option is not available on a new installation, go to Dashboard >> Customize Dashboard >> Add more Blocks. There you can add the "Management Block" which will have the Structure option.
When working with large numbers of blocks (say, more than 100), it may be necessary to increase
max_input_vars in php.ini. Otherwise, blocks may not save in regions correctly when moved.
Technical details for Drupal 7
Core module: Yes.
Related Modules: Dashboard.
Permissions: Administer blocks. Also see the API docs at block permission.
API Documentation: block.admin.inc, block.api.php, block.install, block.module, block_test.module
Template files: block-admin-display-form.tpl.php, block.tpl.php
Other files: block.info, block.css, block.js
Database tables (4): block, block_role, block_custom, cache block. Also see the API docs at block schema.