Drupal 6 Cheat Sheets

hay friends;

I was in search for some cheat sheets that could easily help me to remember the main constructs of Drupal 6 programming and eventually i found :).
You may download the cheat sheet for Drupal 6 here:

Hope these would be helpful for someone other too.


Drupal Book :: drupal 6 javascript and jquery

hay Friends,
Another good book for Drupal community: Drupal 6 JavaScript and jQuery released by Packt. This is 2nd great book by ‘Matt Butcher’ released on March 2009. This book greatly explain how to make it easy to work in Drupal using jQuery or simple java script. I read a free chapter of this book and i found it well versed about using JQuery in Drupalish modules. I am really dying to read this cool book 😛 .

A good Book for Drupal 6 and JQuery

A good Book for Drupal 6 and JQuery

Hopefully, I’ll get it very soon INSHAALLAH 🙂 .

Drupal 6 :: Custom Search Box

hello Friends,

I came across a scenario where it was needed to customize Drupal 6 search box for my current drupal based theme and this customization was needed to :

  1. Change Default text on submit button
  2. Change Default text in search box (Search this site)
  3. When user clicks on search box, default search box text should disappear

All of above tasks should be easily attainable if you are not working in Drupal but it doesn’t mean that these are very difficult while working in Drupal. Somehow, it is a little tricky.

Most recommendable and suitable way that i found was to create a new module and use form_alter hook to track the search form events and bring all above changes in these events.

I’ll recommend you to read this thread: http://drupal.org/node/214592 where Heine helped alot to get clear ideas about form_alter hooks and their usage. Hopefully it will help you too.

Now lets move towards the solution.

First of all create a new module under sites/all/modules with any name. Say it is named ‘abc’ (supposing that you will be aware of the process of module creation and all files needed to create for a new module in Drupal). Open your abc.module file and create a new function there named ‘abc_form_alter‘ having parameters (&$form, $form_state, $form_id).  Basically, ‘abc_form_alter‘ will implement hook_form_alter (explained well http://drupal.org/node/214592) and will use this function to grab search form events and implement my search box changes on triggering of those events.  So this is the summary of our solution and following code you’ll write in abc.module file.

function abc_form_alter(&$form, $form_state, $form_id) {
	$form['submit'] = array('#type' => 'submit', '#value' => t('[ GO ]'));
	$form['search_theme_form']['#default_value'] = 'Search My Site';
	$form['search_theme_form']['#attributes'] = array('onfocus' => "if (this.value == 'Search My Site') {this.value = '';}" );

and That’s All 🙂 .

Lets make a short review on above code,

This condition if($form_id==’search_theme_form’) will check if ‘search_theme_form’ is about to render then do following stuff:

 $form['submit'] = array('#type' => 'submit', '#value' => t('[ GO ]'));

Above Line will change the default submit button text and make it to be [ GO ]

 $form['search_theme_form']['#default_value'] = 'Search My Site';

This code Line will Change Default text in search box and make it to be ‘Search My Site’

 $form['search_theme_form']['#attributes'] = array('onfocus' => "if (this.value == 'Search My Site') {this.value = '';}" );

This final code line gives the way to change any attribute for this text box (you may use it to change the default css class used for search box, too). Here i changed the ‘onfocus’ attribute and wrote the javascript code so when user click on search box for searching some keyword, search box’s default text (Search My Site) should get vanished.

One last thing, if you’r at very basic level in Drupal or even not a programmer then i’ll recommend you to go for this module Custom Search Box. This module is good but keep in mind that you won’t have everything in your hand while using this module but above process can help you to play freely with search form attributes.

I hope this post will open new horizons for you to customize any Drupal based Form 🙂 .

Drupal theme Anatomy

hello Friends,

For those who are starting to learn Theme development of Drupal, following image will help a lot to get clear idea for Drupal theme Anatomy. I found this image while surfing on internet so thought to share with you.

Drupal theme Structure and anatomay

To Learn Drupal theme Structure and Anatomay

Keep Happy Drupaling! 🙂

Start on Drupal development

Hello friends,
As per my client’s requirement, i have started my work on Drupal Applications.  I am developing new modules in Drupal and running in cool 🙂 .

My client’s requirement was to develop some new modules for Drupal and bring Template related settings so i started my study on it.  I Goolged and found great help about Drupal but  a book named “learning-drupal-6-module-development” helped me a lot in getting clear ideas for Drupalish development.

Every one of you must study it for getting clear ideas about Drupal development. I found it really more then great (at least for me 🙂 ). I found this book for free so pasted here too: learning-drupal-6-module-development

For those who don’t know about Drupal, it is an open source CMS (content management system) providing solution for quick development of robust and dynamic websites.

Though Drupal’s code is not Object Oriented but it brings flavor of object orientation, while you follow it’s coding standards.

If you talk about just installation and configuration then i must say, it is more easy then breathing. It just asks you for few database and website related settings and thats it.
Drupal may be easily used for following type of websites:

  • Community web portals
  • Discussion sites
  • Corporate web sites
  • Intranet applications
  • Personal web sites or blogs
  • Aficionado sites
  • E-commerce applications
  • Resource directories
  • Social Networking sites

Have i told you that it is totally Free to use? yes it is 😉 .  It is distributed under GNU (General Public License) so anyone can use it for Free

So keep enjoying easy and dynamic website development in Drupal.