Drupal Theming Hans Rossel

download Drupal Theming Hans Rossel

If you can't read please download the document

Transcript of Drupal Theming Hans Rossel

HTML

Maak een Drupal Theme
Hans Rossel - www.koba.be

Theme instellingen

Theme instellingen

Templates: admin/build/themes

Beheertemplate: admin/settings/admin

Eigen template: user/uid/edit (toegangsrecht 'selecteer een andere template' in admin/user/permissions)

Blokken per theme: admin/build/block

Extra variabelen: admin/settings/site-information

Garland

Standard theme Drupal 5 & 6

Fluid dus ok voor backend/admin theme, maar nu ook http://drupal.org/project/admin en http://drupal.org/project/rootcandy

Niet zo goed als frontend

Niet zo goed als starttheme

Theme anatomie

Basisbestanden: phptemplate

.info: definitie van theme

screenshot.png

Css: Gewoonlijk: style, print, ie6

Template files

page.tpl.php, node.tpl.php, block.tpl.php

31 template bestanden in core in D6 (http://drupal.org/node/190815#default-templates)

template.php

Methode 1:
Subtheme van Prefab Theme

Links op drupal.be/nl
http://drupal.be/node/1809 Gratishttp://drupal.org/project/Themeshttp://themegarden.org/drupal6/Betalendhttp://www.topnotchthemes.com/browse http://www.templatemonster.com/drupal-themes.phpAanbevolen methode: Subtheme vb Minelli

Methode 2
Subtheme van Starter Theme

http://drupal.org/project/zen

http://drupal.org/project/genesis

http://drupal.org/project/framework

http://drupal.org/project/hunchbaque

CSS Frameworkshttp://drupal.org/project/blueprint

http://drupal.org/project/ninesixty

Mooie code, Lelijk Theme

Methode 3:
Vanaf eigen html/css prototype

http://drupal.org/theme-guidehttp://www.oswd.org/designs/favorites/http://www.styleshout.com

Zenlike theme:http://www.oswd.org/design/preview/id/3559

Stap 0: Voorzorgen

Zet Admin theme op Garland!

Theme registry wordt gecached!

Handmatig: telkens cache clearen na wijziging in template: Klik op de "cache data opschonen" knop op Beheren > Site-instellingen > Prestatie.

Automatisch: Voeg drupal_rebuild_theme_registry(); toe onderaan template.php (Let op: achteraf terug weghalen!)

STAP 1: Theme map

Maak in sites/all/themes een nieuwe map: abc (voor abc theme)

Plaats je index.html en style.css die je ontworpen hebt erin

Hernoem index.html naar page.tpl.php

STAP 2: .info file
definitie theme

Maak abc.info file met inhoud (copieer garland.info, hernoem en pas aan)

Meer info: .info handbook: http://drupal.org/node/171205

; $Id$name = ABC Themedescription = Heel mooi themeversion = VERSIONcore = 6.xengine = phptemplatestylesheets[all][] = style.cssstylesheets[print][] = print.css

STAP 3: css en js

In .info file:stylesheets[all][] = style.cssstylesheets[print][] = print.cssscripts[] = myscript.js

In page.tpl.php:

STAP 4: page.tpl.php
Variabelen invoegen

Kopiren van Garland of van modules/system: doctype, head en alle variabelen

Constructie invoegen variabelen
(Theme coding conventions: http://drupal.org/node/1965)

Doctype en head copiren