Skip to content

Instantly share code, notes, and snippets.

@ravyg
Last active August 29, 2015 14:06
Show Gist options
  • Save ravyg/c1f9fff8ffe236418c44 to your computer and use it in GitHub Desktop.
Save ravyg/c1f9fff8ffe236418c44 to your computer and use it in GitHub Desktop.
Drupal Theming Basics
- Knowing the ".info" files
Tell drupal about your theme.
- Playing with ".tpl.php" (Template) files
Place for your all HTML structure.
- Variables in ".tptl.php" files
Dynamic bits of content which is to be printed in your template file.
- Theme Functions overriding.
Like $user->name information which has large logic behind it.
That's all a new theme needs.
Themes are usually stored in {drupal-webroot}/sites/all/themes
Go to your terminal and follow following quick steps:
Make a new folder as libraries
(From drupal root)
cd sites/all
mkdir libraries
Get simple HTML DOM:
cd libraries
wget http://sourceforge.net/projects/simplehtmldom/files/latest/download?source=files -O simplehtmldom.zip
Unzip to simplehtmldom:
unzip simplehtmldom.zip -d simplehtmldom
Remove simplehtmldom.zip
rm simplehtmldom.zip
Drush Enable devel themer
drush en devel_themer -y
[If you get message below devel themer is ready to go :) ]
Message:
λ drush en devel_themer -y
The following extensions will be enabled: devel_themer, simplehtmldom, devel
Do you really want to continue? (y/n): y
devel_themer was enabled successfully. [ok]
simplehtmldom was enabled successfully. [ok]
devel was enabled successfully. [ok]
devel defines the following permissions: access devel information, execute php code, switch users
Dynamic Template Names
The way we do with drupal 7 nomenclature:
https://www.drupal.org/node/1089656
List of all the variables available in page.tpl.php:
https://api.drupal.org/api/drupal/modules!system!page.tpl.php/7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment