Basic Theming - 27Aug07 Meeting

Events happening in the community are now at Drupal community events on www.drupal.org.
Michael Hofmockel's picture

27Aug2007
Michael Hofmockel
Converting html/css web design to Drupal PHPTemplate theme.
Another example following the formula from Chapte 8 (The Theme System) from the "Pro Drupal Development" book.

Open Source Web Design - http://www.oswd.org/

Kinda Cloudy - http://www.oswd.org/design/preview/id/3158

  • Renamed index.html to page.tpl.php
  • install theme in sites/test_site/themes/Kinda_Cloudy
  • enable theme in admin

Every page is now the same and we are locked out of admin
CSS does not load yet

  • Open page.tpl.php and replace with variables. In this case we have 3 columns. Add variables for head_title, site_name, sidebar_left, sidebar_right, title, content and footer.

  • rename default.css to style.css. Add variable for styles.

Understanding template files
Draw page 115
Demonstrating how different template files stack-up

Drupal search order for template files based on internal system urls not path or pathauto urls.
page-user-1.tpl.php
page-user.tpl.php
page.tpl.php

When it finds one it quits looking.

To create a custom front page template create
page-front.tpl.php

  • print_r get_defined_vars at the end of your page.tpl.php to expose all defined variables.
  • add other page variables. primary_links, breadcrumb, feed_icons, mission, messages.

  • create block.tpl.php and migrate variables from page to block.tpl.php

Ann Arbor, Michigan

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: