docs:drupal:theming

Theming

Theming is the work necessary to take total control of the output/layout coming from drupal, without using one of the pre-made themes alone. A new theme can use another theme as a base. It would probably be best to review the basic structure before starting, and then take a look at one or more themes located in the core drupal install.

create a folder to contain your theme here: <drupal install>/sites/<sitename such as default>/themes/<your theme name>

Create a page.tpl.php file to style the main layout of your site. Then create a node.tpl.php file to control the content output coming from your nodes. If you create a custom content type, you can then control it by creating a node-<content type>.tpl.php file.

This will control the visual layout of your site.

Once your theme is roughly set up, you need to enable it in the drupal admin, under Administer→Site Building→Themes.

Drupal has a build in css fix for when you need a containing element to always extend to the size of the floated children. To use this, simply give the container a class of clear-block. This avoids the common fixes such as placing a div after the floated elements with “clear: both;”.

Depending on the caching settings of your site, you many not see theming changes right after you make them. To fix this, you need to clear the cache at Administer→Site Configuration→Clear Cached Data

I didn't install it, but there is supposed to be a Dev module that provides an easy link or something to do this faster.

  • docs/drupal/theming.txt
  • Last modified: 2010/03/20 23:31
  • by billh