Tuesday, 23 March 2010

How to create Custom Block?

Following is a simple example of custom block. For more information on blocks in general,
see the Blocks page of the handbook.
Adding A 'Contact Information' Block
A business or support group should always let people know how to contact them. One easy
thing is to include your mailing address on your pages. This is about the easiest kind of
block to start with.
1. Go to Administer>>Site building>>Blocks. It should already be sitting on your default theme, but if not, select the right one.

2. Click on the "Add block" tab.

3. Fill in the "Description" and "Body." Here's a sample body:
Example Organization<br>
The Drupal Cookbook (for beginners) http://drupal.org/book/export/html/120612
19 of 39 25.10.2008 18:42
123 Main St.<br>
Mytown, State Zip<br>
(123) 456-7890

4. Save the block.

5. Now you can "Configure" the block to add the block's title and define it's "Visibility".

6. Follow the Configure link next to the block and enter "Contact Information" as the Block's title.

7. Decide if you want to allow users to turn the block on or off, and, if so, which roles should have that ability. You can leave this with no changes to allow everyone to see it. Then choose which pages it will be shown on; Leave this empty to show the block on all pages.

8. Save the block.

9. Now you're back on the block list. Find the block you just created in the list and choose a "Region". You can use the "Weight" parameter to set its position with in the selected area; again, I like the address at the bottom, so I use a heavier weight.

10. Click on the "Save blocks" button.

and done.

Enjoy Drupaling !


No comments:

Post a Comment