Themeing best practice

While developing a theme for Drupal, there are best practice one should always follow.
If you are deriving your theme from another theme/theme framework, make sure you name your theme in unique way, otherwise there can be conflicts in theme function names.

Read more: Themeing best practice

Theme Developers

Developing a theme in Drupal is quite a fun. It tests your knowledge and skills both in HTML/CSS and Drupal API. A Drupal Theme Developer, who is proficient both in HTML/CSS and Drupal API can create great themes. Developing Drupal themes is little bit time consuming and one has to test it with all the popular browsers and has to make it cross browser compatible.

Read more:  Theme Developers.

Drupal Module Development tool

To develop drupal modules and any kind of customization of a drupal site, we use different tools. Lets discuss which combination is perfect for Drupal Development. My combination is as follow:

OS: windows
Server: WAMP
Editer: Eclipse
browser(s):
FF with Firebug & web development toolbar
IE, Opera & Chrome: for check the cross browser compatibility only.

Read: Drupal Module Development tool.

Automatic redirection to node translation form

This code will redirect you to the translation form of a node after you have created a node. Make sure you have selected a language and not “Language neutral” when saving the node.

Read: Automatic redirection to node translation form.

What do you prefer to develop a Drupal theme?

Poll: What do you prefer to develop a Drupal theme?.

Drupal hook: hook_link

hook_link lets us define links to be displayed on nodes and comments. These are the links wich makes it easy for the end user to access more information related to a node. Like adding comment, accessing the tags and sending feedback to node authors or site admin using
http://ly2.in/B]EGD_ module.

Read more: Drupal hook: hook_link.

Content types in tile with images

This CodeLet will create a tiled page with all the content type listed with individual image uploaded using the admin form. This CodeLets demonstrates user of different Drupal APIs like file_save_upload, hook_menu and hook_perm …

Read more: Content types in tile with images.

Drupal file upload: file_save_upload

Drupal’s file_save_upload function saves an uploaded file to a new location as specified in the parameter of the function.

Syntax:
Drupal 5: file_save_upload($source, $dest = FALSE, $replace = FILE_EXISTS_RENAME)
Drupal 6: file_save_upload($source, $validators = array(), $dest = FALSE, $replace = FILE_EXISTS_RENAME)
Drupal 7: file_save_upload($source, $validators = array(), $destination = FALSE, $replace = FILE_EXISTS_RENAME)

  • $source: This will be the field name using which the file is being uploaded.
  • $validators: This is an associative array of callback functions which validate the uploaded file. The function names are keys and and values of the array will be any arguments to be passed to the function callback…

Read more: Drupal file upload: file_save_upload.

Drupal hook: hook_user

Drupal offers user management out of the box. This includes new user registration, log in, password mailer and user session management. Drupal stores password as md5 hash value. When a user provides her log in credentials, Drupal generates md5 has values for the password provided and compares it with the one stored in the database against the provided username/email address. This is a well known technique implemented by Unix.

Though Drupal manages the users, we can still alter the behavior of different default actions on a user activity. For example, if you log in from the front page, by default, you will be redirected to front page. Instead we can make to redirect to different page or different front page, that can only be accessed by logged users. To achieve this, we need to use hook_user Drupal hook.

Read more  Drupal hook: hook_user.

Drupal: Auto complete field

Drupal auto complete field lets you select values appear as you type in the text box. Which maximizes the usability and user experience.

Think of a situation, You are creating a custom search function which display author picture, some text containing the word(s) you are typing and node post date.

This can not be achieved by creating a CCK auto complete field since such fields can be added to node types only. You need to create a custom module and write hook_search (no more supported in Drupal 7.x). You have to define a extra attribute in your text box definition: #autocomplete_path. The value this attribute takes is a path defined with hook_menu known to your Drupal site. Any non-existing path assigned to this attribute will result in error. So, first make sure you have defined the path and the callback function with proper permissions.

The auto complete works on ‘change’ event of the text box. As you type, the path defined in #autocomplete_path calls the function defined in ‘callback function’ of the menu definition. The function may fetch values from the site database contact third party services.

The function should return an array with key-value pairs. The values matching with the text in the text box will be displayed under the text box and you can select any of the values using either mouse of up-down keys.

Read more: Drupal: Auto complete field.

Rss Feed Tweeter button Facebook button Technorati button Reddit button Myspace button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button Youtube button