<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Drupal_7_Themes</id>
	<title>Drupal 7 Themes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Drupal_7_Themes"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Drupal_7_Themes&amp;action=history"/>
	<updated>2026-04-24T02:48:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Drupal_7_Themes&amp;diff=89035&amp;oldid=prev</id>
		<title>Lsokolowski1: Removed protection from &quot;Drupal 7 Themes&quot;</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Drupal_7_Themes&amp;diff=89035&amp;oldid=prev"/>
		<updated>2025-08-27T17:23:43Z</updated>

		<summary type="html">&lt;p&gt;Removed protection from &amp;quot;&lt;a href=&quot;/training/Drupal_7_Themes&quot; title=&quot;Drupal 7 Themes&quot;&gt;Drupal 7 Themes&lt;/a&gt;&amp;quot;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:23, 27 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Lsokolowski1</name></author>
	</entry>
	<entry>
		<id>https://training-course-material.com/index.php?title=Drupal_7_Themes&amp;diff=35731&amp;oldid=prev</id>
		<title>Łukasz Sokołowski at 12:12, 22 June 2016</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Drupal_7_Themes&amp;diff=35731&amp;oldid=prev"/>
		<updated>2016-06-22T12:12:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Draft}}&lt;br /&gt;
{{Cat|Drupal}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;slideshow style=&amp;quot;nobleprog&amp;quot; headingmark=&amp;quot;⌘&amp;quot; incmark=&amp;quot;…&amp;quot; scaled=&amp;quot;false&amp;quot; font=&amp;quot;Trebuchet MS&amp;quot; &amp;gt;&lt;br /&gt;
;title: Drupal 7 Themes&lt;br /&gt;
;author: Lukasz Sokolowski (NobleProg Ltd)&lt;br /&gt;
&amp;lt;/slideshow&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Drupal 7 Themes ==&lt;br /&gt;
Drupal 7 Themes Training Materials&lt;br /&gt;
&lt;br /&gt;
{{Can I use your material}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing Existing(Contributed) Themes ⌘==&lt;br /&gt;
Very similar way like installing modules.&amp;lt;br&amp;gt;&lt;br /&gt;
We can do it:&lt;br /&gt;
* manually from &amp;#039;drupal.org&amp;#039; &lt;br /&gt;
* via &amp;#039;drush dl&amp;#039;&lt;br /&gt;
* in our website in configuration &amp;#039;Appearance/Install new theme&amp;#039;&lt;br /&gt;
&lt;br /&gt;
After installation we can just &amp;#039;Enable&amp;#039; or &amp;#039;Enable and set default&amp;#039; in Appearance section in management menu.&lt;br /&gt;
&lt;br /&gt;
Drupal 7 themes garden(nice demo):&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;small&amp;gt;(http://www.opennomad.com/drupal-themes/about)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual theme installation ⌘===&lt;br /&gt;
Manually download the theme package and uncompress its content &amp;#039;into sites/all/themes&amp;#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
You can use browser and GUI(files navigator) or command line tools like &amp;#039;wget&amp;#039; and &amp;#039;tar&amp;#039; .&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 1 ⌘===&lt;br /&gt;
Find &amp;#039;Mayo&amp;#039; theme in &amp;#039;drupal.org&amp;#039; site and install it manually.&amp;lt;br&amp;gt;&lt;br /&gt;
Play a while with it&amp;#039;s plenty bunch of options.&lt;br /&gt;
&lt;br /&gt;
=== Exercise 2 ⌘===&lt;br /&gt;
Install &amp;#039;Zen&amp;#039; theme via drush.&lt;br /&gt;
&lt;br /&gt;
== Modifying an existing Theme ⌘==&lt;br /&gt;
&lt;br /&gt;
We can copy for example one of default Drupal core themes like Bartik or Stark.&lt;br /&gt;
&lt;br /&gt;
Then place it into &amp;#039;sites/all/themes&amp;#039;, rename all convenient files and change files: css, templates, js, images, etc.&lt;br /&gt;
&lt;br /&gt;
This is the simplest way to create our theme without much effort.&lt;br /&gt;
&lt;br /&gt;
=== Exercise 3 ⌘===&lt;br /&gt;
Let&amp;#039;s create &amp;#039;BlaBla&amp;#039; theme.&lt;br /&gt;
&lt;br /&gt;
Changes to do:&lt;br /&gt;
* Copy Bartik theme from &amp;#039;your_website/themes&amp;#039; to &amp;#039;sites/all/themes&amp;#039;&lt;br /&gt;
* Find all instances of &amp;#039;bartik&amp;#039; name in all copied files and replace it with &amp;#039;blabla&amp;#039;&lt;br /&gt;
* Make site name font &amp;#039;24px&amp;#039; and site slogan &amp;#039;red&amp;#039; (style.css)&lt;br /&gt;
&lt;br /&gt;
== Subthemes ⌘==&lt;br /&gt;
&lt;br /&gt;
Themes which can inherit css, js, etc from base theme and override those files, partly or completely.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;(https://www.drupal.org/node/225125)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exercise 4 ⌘===&lt;br /&gt;
&lt;br /&gt;
Create sub-theme with &amp;#039;Zen&amp;#039; theme:&lt;br /&gt;
* Drush way:&lt;br /&gt;
** enable &amp;#039;zen&amp;#039; theme and refresh all caches &amp;#039;drush cc all&amp;#039;&lt;br /&gt;
** in command line(terminal) type &amp;#039;drush zen &amp;quot;Cosmic Science&amp;quot; cosmicscie&amp;#039; and press &amp;#039;Enter&amp;#039;&lt;br /&gt;
** enable and set default the theme &amp;#039;Cosmic Science&amp;#039;&lt;br /&gt;
** &amp;lt;small&amp;gt;(https://www.drupal.org/node/2021609)&amp;lt;/small&amp;gt;&lt;br /&gt;
* Manual way (loooooong):&lt;br /&gt;
** copy the STARTERKIT from &amp;#039;zen&amp;#039; folder into &amp;#039;sites/themes/&amp;#039;&lt;br /&gt;
** follow all necessary steps from the docs below:&lt;br /&gt;
*** &amp;lt;small&amp;gt;(https://www.drupal.org/node/1549668)&amp;lt;/small&amp;gt;&lt;br /&gt;
* Override at least one css file in your sub-theme&lt;br /&gt;
&lt;br /&gt;
== Theme system ⌘==&lt;br /&gt;
The theme system, which controls the output of Drupal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;(https://api.drupal.org/api/drupal/includes%21theme.inc/7)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Themable drupal elements (via theme function or template file):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;http://api.drupal.org/api/group/themeable/7&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Theme engines ⌘==&lt;br /&gt;
&lt;br /&gt;
Drupal 7 available engines:&lt;br /&gt;
* By default Drupal uses PHPTemplate engine &amp;lt;small&amp;gt;(https://www.drupal.org/project/phptemplate)&amp;lt;/small&amp;gt;  &lt;br /&gt;
* PHPTAL &amp;lt;small&amp;gt;(https://www.drupal.org/project/phptal)&amp;lt;/small&amp;gt;&lt;br /&gt;
* ETS Easy Template System &amp;lt;small&amp;gt;(https://www.drupal.org/project/ets)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== PHPTemplate Engine ⌘==&lt;br /&gt;
Handles integration of PHP templates with the Drupal theme system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;(https://api.drupal.org/api/drupal/themes%21engines%21phptemplate%21phptemplate.engine/7)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Creating a new theme from scratch ⌘==&lt;br /&gt;
Let&amp;#039;s create &amp;#039;Difficult Dirty&amp;#039; theme.&lt;br /&gt;
&lt;br /&gt;
General steps:&lt;br /&gt;
# Create or modify an HTML file(s)&lt;br /&gt;
# Create or modify a CSS file(s)&lt;br /&gt;
# Create an .info file&lt;br /&gt;
# Standardize the file names according to Drupal conventions&lt;br /&gt;
# Insert available variables into template&lt;br /&gt;
# Create additional files for individual node types, blocks, etc&lt;br /&gt;
&lt;br /&gt;
=== File .info ⌘===&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name = Theme Name&lt;br /&gt;
core = 7.x&lt;br /&gt;
&lt;br /&gt;
; Regions&lt;br /&gt;
regions[headers] = Header&lt;br /&gt;
; css&lt;br /&gt;
stylesheets[all][] = css/style.css&lt;br /&gt;
; js&lt;br /&gt;
scripts[] = js/jcarousel.js&lt;br /&gt;
; Settings&lt;br /&gt;
; - download &amp;#039;nexus&amp;#039; theme and look for settings in its nexus.info file&lt;br /&gt;
; settings[breadcrumbs]  = 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Related theme settings docs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;(https://www.drupal.org/node/221905)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exercise 5 ⌘====&lt;br /&gt;
Create theme &amp;#039;Difficult Dirty&amp;#039; from scratch:&lt;br /&gt;
* make dir here &amp;#039;your_site/sites/all/themes/difficultdirty&amp;#039;&lt;br /&gt;
* in newly created dir add file &amp;#039;difficultdirty.info&amp;#039; with following content and enable the theme and test the website:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
name = Difficult Dirty&lt;br /&gt;
description = Scratchy DD theme&lt;br /&gt;
core = 7.x&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== CSS file ⌘===&lt;br /&gt;
To simplify process and speed up things (one day course) we will use parts of existing theme called &amp;#039;Simple Clean&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
==== Exercise 6 ⌘====&lt;br /&gt;
Prepare css file:&lt;br /&gt;
* download &amp;#039;simpleclean&amp;#039; theme (drush dl), but do not enable it&lt;br /&gt;
* copy its &amp;#039;style.css&amp;#039; file into &amp;#039;your_site/sites/all/themes/difficultdirty/css&amp;#039;&lt;br /&gt;
* in file &amp;#039;difficultdirty.info&amp;#039; add line &amp;#039;stylesheets[all][] = style.css&amp;#039;&lt;br /&gt;
* refresh theme registry&lt;br /&gt;
* test the website&lt;br /&gt;
&lt;br /&gt;
=== Theme functions ⌘===&lt;br /&gt;
Related materials:&lt;br /&gt;
&lt;br /&gt;
http://training-course-material.com/training/Drupal_7_for_Developers#Presentation_layer_.E2.8C.98&lt;br /&gt;
&lt;br /&gt;
=== Structure of a Drupal Page ⌘===&lt;br /&gt;
[[File:tplFlow.png]]&lt;br /&gt;
&lt;br /&gt;
=== Template Files ⌘===&lt;br /&gt;
&lt;br /&gt;
Main template files we usually want to override(they have sets of variables):&lt;br /&gt;
* html.tpl.php modules/system&lt;br /&gt;
* page.tpl.php modules/system&lt;br /&gt;
* node.tpl.php modules/node&lt;br /&gt;
* region.tpl.php modules/system&lt;br /&gt;
* block.tpl.php modules/block&lt;br /&gt;
* field.tpl.php modules/field/theme&lt;br /&gt;
&lt;br /&gt;
List of available template files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;(https://www.drupal.org/node/190815)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Exercise 7 ⌘====&lt;br /&gt;
Override &amp;#039;page.tpl.php&amp;#039; in our &amp;#039;Dirty&amp;#039; theme:&lt;br /&gt;
* we want to put additional static message &amp;#039;Hack, I&amp;#039;m soooo dirty!&amp;#039; in footer, but only on front page&lt;br /&gt;
** copy &amp;#039;modules/system/page.tpl.php&amp;#039; into &amp;#039;sites/themes/difficultdirty/templates&amp;#039;&lt;br /&gt;
** use &amp;#039;$is_front&amp;#039; variable to determine if user is on front page&lt;br /&gt;
** add message in footer&amp;#039;s div&lt;br /&gt;
&amp;lt;!-- &amp;lt;?php if ($is_front): ?&amp;gt;&amp;lt;div id=&amp;quot;additional_message&amp;quot;&amp;gt;&amp;lt;?php print &amp;quot;Hack, I&amp;#039;m soooo dirty!&amp;quot;; ?&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;?php endif; ?&amp;gt; --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Template suggestions ⌘===&lt;br /&gt;
&lt;br /&gt;
Functions which suggest some possible changes to theme registry:&lt;br /&gt;
* _process_&lt;br /&gt;
* _preprocess_&lt;br /&gt;
&lt;br /&gt;
We usually add them in &amp;#039;template.php&amp;#039; file.&lt;br /&gt;
&lt;br /&gt;
EXAMPLE: Load different &amp;#039;page.tpl.php&amp;#039; regarding to node type&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function ThemeName_preprocess_page(&amp;amp;$vars, $hook) {&lt;br /&gt;
  if (isset($vars[&amp;#039;node&amp;#039;])) {&lt;br /&gt;
    $vars[&amp;#039;theme_hook_suggestions&amp;#039;][] = &amp;#039;page_&amp;#039;. $vars[&amp;#039;node&amp;#039;]-&amp;gt;type;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
* working with suggestions &amp;lt;small&amp;gt;(https://www.drupal.org/node/223440)&amp;lt;/small&amp;gt;&lt;br /&gt;
* overview &amp;lt;small&amp;gt;(https://www.drupal.org/node/1089656)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO: --&amp;gt;&lt;br /&gt;
&amp;lt;!-- == Theming Blocks and Content Types ⌘== --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Devel Module(s), Other Helpers ⌘==&lt;br /&gt;
devel/theme/registry&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
devel_themer&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Theme debug mode:&lt;br /&gt;
* in file &amp;#039;settings.php&amp;#039; add line &amp;lt;pre&amp;gt;$conf[&amp;#039;theme_debug&amp;#039;] = TRUE;&amp;lt;/pre&amp;gt;&lt;br /&gt;
* inspect or view source&lt;br /&gt;
&lt;br /&gt;
== Firefox tools ⌘==&lt;br /&gt;
&lt;br /&gt;
Plugins - Firebug and Webdeveloper&lt;br /&gt;
&lt;br /&gt;
&amp;#039;Drupal for firebug&amp;#039; module&lt;/div&gt;</summary>
		<author><name>Łukasz Sokołowski</name></author>
	</entry>
</feed>