It’s becoming highly important for businesses to set up mobile versions of their corporate websites. This is because a good majority of individuals rely on their cell phones to access the Internet. If you don’t have a mobile-compatible website, then you are definitely missing out on quality business!
A responsive theme is a flexible theme with a fluid grid system that adapts your website to any viewing environment. Drupal Base themes that support responsive design are Zen 7.x-5.x, Adaptivetheme and Omega. To create a responsive theme, it is always recommended to use a Base theme and then create a subtheme. Let us create a subtheme of Omega Theme.
You can create an Omega subtheme by using any of the following methods::
- Omega Tools (Recommended)
- Drush (For Advanced Users)
Using Omega Tools: Omega Tools allow you to create a subtheme using Drupal administration.
- Install and enable Omega Tools Module (http://drupal.org/project/omega_tools)
- Navigate to "Administration" -> "Create a new Omega subtheme"
- Add a theme name.
- Tick against the check box "Install automatically" to automatically place the theme in the selected destination. This feature requires you to have write permission for the selected destination.
- Choose the base theme. There are two choices, Alpha and Omega. Alpha has the basic CSS reset, grid, core layout, interface, debugging and basic templating functions. Omega adds panel integration and a selection of default styling css files. In 99% of cases you want to base your subtheme on Omega. It's ideal to choose Omega.
- Choose the Starterkit as per your requirement. For example, the Omega HTML5 Starterkit.
- Click "Save" and continue.
- Add the description and version. Click "Finish".
- Your sub-theme has been created. Check your selected destination for the theme. For example, the "all/themes" directory.
- By default, the sub-theme contains the following files and directories:
Now enable the sub-theme and play with the files to create the theme as per your design.
Note: Do not enable the Alpha and Omega core themes.
CSS: By default, you will have 5 css files. 1 global.css for all the layouts and 4 .css files prefixed with your sub-theme name for different layouts.
Preprocess: Any custom preprocess functionality can be placed in the preprocess folder rather than directly in template.php. We can create the files in the name such as:
- TEMPLATE_preprocess_html() = preprocess-html.inc
- TEMPLATE_preprocess_page() = preprocess-page.inc
- TEMPLATE_preprocess_node() = preprocess-node.inc
- TEMPLATE_preprocess_comment() = preprocess-comment.inc
- TEMPLATE_preprocess_region() = preprocess-region.inc
Process: Like preprocesses, any custom process functionality can also be placed in the process folder rather than directly in template.php. Files can be in a syntax as follows:
- TEMPLATE_process_html() = process-html.inc
- TEMPLATE_process_page() = process-page.inc
- TEMPLATE_process_node() = process-node.inc
- TEMPLATE_process_comment() = process-comment.inc
- TEMPLATE_process_region() = process-region.inc
Templates: You can copy any .tpl.php file and customize them accordingly.