Drupal 7 Tutorial Part 4: Understanding Drupal 7 Blocks Concept

posted Jun 23, 2011, 12:29 AM by admin@ revitviet.vn   [ updated Jun 23, 2011, 5:32 AM ]

Hi Everyone,

In last tutorial we learnt what is a node in Drupal. Now, we will see what is a block in drupal and how to add a block, display block in different pages of drupal website.

What is a block in drupal ? :

  • Block is a visible area that displays data in different regions of a drupal website.

The above answer arises one question. 

What is a region in drupal ? :

Regions are nothing but drupal page is divided into various sections or parts known as regions where data can be displayed. To examine the regions in Drupal 7 follow below steps.

  • Login to your drupal website as administrator. You will see screen something like below.
  • Now click on Structure link on top black menu bar you will see a popup with links. Now click on blocks section. You will see page something like below.

  • Now click on Demonstrate block regions like which is just above Add block link. Now you can see various drupal regions of your site. Just like below page.

  • You can see various regions such as Header, Featured, Sidebar First, Sidebar second etc.In these above regions we can place blocks. So, lets try to create some blocks and enable them in above regions.

How to create a block in drupal 7 and enable them ?

       We can create Drupal Blocks using two ways.

  • Using Drupal Administrator User Interface.
  • Using PHP code and Drupal API.

           As a beginner let's see how to create a block using drupal adminstrator interface. In my future posts when i am dealing with module development i will explain how to create block using php code and drupal api.


  • Login as a adminstrator into your drupal 7 site. Now click on Structure menu link on top admin navigation bar. Now you can see a overlay with various links. Click on Blocks link. To add a new block, click on Add Block link in blocks section. You will see page like below when you click on add block link.


  • Give block description as "Contact Us Block". This will apppear in blocks manage section. Basically, block description is administrative name to identify block.
  • Fill Block title text field as "Contact Us".
  • Fill Block body as

No 201, 6th Main,
MG ROAD, Bangalore,
India, 560094
Mobile: +91- 80XX788XX8

  • Now go to region settings and select "Sidebar second" for bartik theme and leave the field seven (adminstration theme). More about these setting i will discuss in my next tutorial.
  • Now click on Save Block button. Immediately after submit you will be redirected to block manage page and you will see a status message "The block has been created.".
  • Now go to your home page. You can see contact us block that you created on home page right hand side in "sidebar second region." Just like below.


So finally we learnt how to create a block and enable them in different regions. Stay tuned with me to learn more about block settings and configurations in my next post.



Anil Sagar