Drupal 7 Theme System

  • View
    4.597

  • Download
    2

  • Category

    Design

Preview:

DESCRIPTION

Brief presentation about Drupal 7's theme and template system.

Citation preview

Drupal 7 Theme System

Theme

http://drupal.org/project/themes

Theme from scratch

sites/default/themes/NAME

NAME.info

name = My super themecore = 7.xengine = phptemplate

NAME.infostylesheets[all][] = css/style.css

css/style.cssFile

all,print,

screen,projector

Webkit InspectorFirebug

IE Developers Toolbar

NAME.infoscripts[] = js/actions.js

js/actions.jsFile

Regions

Name.inforegions[sidebar] = Sidebarregions[ads_mini] = Small adsregions[ads_big] = Big ads

first, sidebar second,

content, header,

footer, highlighted,

help, page_bottom,

page_top

NAME.infosettings[main_color] = 'orange'

theme-settings.php

theme_get_settings(VAR);

Templates

Overriding template files

copy

Special template files

node--nodeid.tpl.phpnode--type.tpl.phpnode.tpl.php

block--module--delta.tpl.phpblock--module.tpl.phpblock--region.tpl.php

http://drupal.org/node/1089656

page.tpl.phppage--node.tpl.phppage--node--%.tpl.phppage--node--1.tpl.phppage--node--edit.tpl.phppage--front.tpl.php

Template function

theme(HOOK, ARGS[]);imageitem_listlinklinkstableusernamebreadcrumb...

Overriding template function

1. NAME_HOOK()2. sites/default/themes/NAME/HOOK.tpl.php3. theme_HOOK()

function mytheme_table($header, $rows, $args)

Preprocess functions

TEMPLATE_preprocess(&$variables, $hook)

TEMPLATE_preprocess_HOOK(&$variables)

Defining your own template

HOOK_theme()

Distributing content

Subtheme

http://drupal.org/node/225125