Minimal Drupal 6 Theme Creation
How to get started creating a new custom theme for Drupal, using only minimal code. This is basically a combination of css-only theming, and basic intro theming.
Create a new theme folder in /sites/all/themes/. Let's call it "minimal". So you should now have this folder: /sites/all/themes/minimal/.
Create a new empty text file in that folder called "minimal.info"
Put this essential information in it:
name = Minimal
description = Minimal theme.
core = 6.x
engine = phptemplate
In your site, go to admin/build/themes and enable the new theme that now shows up: Minimal. You will still be able to use all admin features of the site, but it will look very plain. If you're scared, you can create a test user, switch to that user, and have that user select this minimal theme.
Override a default template file
- All default theming is controlled by modules.
- So to override the output of the main page layout, find the module that is controlling it. For example, the main page layout is controlled by the system module.
- Copy /modules/system/page.tpl.php to /sites/all/themes/minimal/page.tpl.php. The theming system will automatically detect this file and use yours instead of the default module's.
- Add a bit of text somewhere, maybe just after the opening
<body>tag, just to make sure you're overriding the default template. Do this in the new file, in /sites/all/themes/minimal/page.tpl.php.
- Clear your cache at admin/settings/performance, and you should see the new bit of text that you added. You can proceed to rearrange other things, add, delete, however you wish to modify it.
Override default CSS
- Find the CSS file that you want to override. For example, /modules/system/system.css.
- Copy it to /sites/all/themes/minimal/system.css.
- add a line to minimal.info
stylesheets[all] = system.css
- this removes the original from your template, and uses your new copy instead.
These techniques also work for contrib modules that include .tpl.php and CSS files.
- http://drupal.org/node/171194 Basic Template Structure (node.tpl.php, page.tpl.php, etc.)
- http://drupal.org/node/173880 Overriding Themable Output
- http://drupal.org/node/171209 Stylesheets, including overriding default stylesheets
- http://www.lullabot.com/blog/6-get-your-css-only-theme-right-here CSS Only theming (lullabot article)