Blocks in Drupal

This tutorial is designed to help beginners learn how to create, edit and configure blocks in the Drupal content management system. To follow along go to the “block” page on your site. If you are using a standard Drupal installation you can find the “block” page by going to “site building” then “blocks.” On sites that we build for clients we create a link under “Content Management” called “Edit Menus.” That goes to the same place. At any rate the page you need to get to can be found under admin/build/block.

There are essentially three types of blocks in Drupal.

  • Menu blocks. Menu blocks - take menus that you have created in the Menu page and allow you to choose if and where they appear on your site.
  • Module related blocks - are created by a particular block and which display information related to that module. An example of this kind block would be the translation block for the i18n internationalization module.
  • Html Blocks – These are blocks that you create directly in the block page, but which make use of existing menus or modules. Instead the user has the option of entering any text or html they wish. These can include images, php, JavaScript and even flash.

Menu blocks, and Module blocks can’t be created in the block page. They already exist. All you have to do is enable them by selecting the region where you want them to appear and then clicking submit. Html blocks, on the other hand, are created by clicking the add block tab on the top of the block page. Once created this custom block will then appear in the list of available blocks where it will need to be assigned a region like any other block.

When you go to the blocks page you find a list of blocks that are currently available in your site. This list has 3 columns: Block, Region, Weight, and Operations. If you have blocks already activated then the items in the list will be the list of the blocks are currently being used. Under the list of activated blocks there is a list of the available blocks that are currently Disabled. If a block is disabled the dropdown menu in the region column will say <none>.

drupal-blocks

When you want to activate a block the main fields you need to alter are “Region” and “Weight” fields.

  • Regions are the areas on the page that are set up to hold blocks. Examples of Regions are “Right sidebar”, “Left sidebar”, or “Footer.” You can put any block into any region you want to, though some particular blocks work best when placed in certain regions. A web designer can even add custom regions for you, and customize the way the blocks in those regions appear. You can even do it yourself if you are so inclined and are willing to take the time to really learn how to work with CSS, html, and the php template system.
  • Weight is the position of that block in relation to all the other blocks in that region. -10 is the highest block, and 10 is the lowest, and blocks that share the same weight will be positioned in relation to the date and time that they were created.

Advanced Configuration Options for Blocks

The configure link located to the right of the block listing goes to a configuration page that contains a number of options for individual blocks including visibility options, title display, roles that are allowed to view that block and php script options for advanced users. For most people the most useful configuration settings here are the “Role settings”, and the “Page Specific Visibility Settings.” Role settings set which types of users in your site will have permissions to view this particular block. Page specific visibility settings determine on which pages the block will appear. For the page settings the box labeled “Pages” is to be filled out with a list of urls in your site each separated by a space.

For example:
node/23
breaking-news-iraq
node/25

You get the idea.
You can set the block to appear only on the pages listed, or on all pages except the pages listed.

Category:

Options d'affichage des commentaires

Sélectionnez la méthode d'affichage des commentaires que vous préférez, puis cliquez sur "Sauvegarder les paramètres" pour activer vos changements.

Thanx

Thanx for this article helped me a lot :D

Poster un nouveau commentaire

CAPTCHA
Est vouz humain? Il faut demander.
14 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

copyright © 2007