Community Documentation

Tools for upgrading themes

Last updated November 22, 2012. Created by Erich Schulz on November 19, 2012.
Log in to edit this page.

This page is a stub for collating automated theme upgrade steps.

You'll want to run these sed commands over (the copy of) your old d6 themes and then do a diff to make sure nothing is broken.

Please edit this page to refine the steps you have taken.

If your theme is derived from a classic drupal theme, carried forward into drupal 7, then diff3 is a useful tool:

f=style.css
a6=~/antarqld.org.au/sites/all/themes/ANTaRQld2
g6=~/antarqld.org.au/themes/garland
g7=~/copyc.antarqld.org.au/themes/garland
a7=~/copyc.antarqld.org.au/sites/all/themes/a3

cd ~/tmp

cp $a6/$f a6.$f
cp $g7/$f g7.$f 
cp $g6/$f g6.$f 

# MYFILE OLDFILE YOURFILE

diff3 -m a6.$f g6.$f g7.$f > a7.$f

echo "Now you need to edit a7.$f and then:"
echo "   cp a7.$f $a7/$f

To do some automated search and replaces, sed is useful:

s|<body(.*)>|<body\1> <?php print $page_top; ?>|

#$search_box is now a block.
/$search_box/d

s|\$primary_links|$primary_menu|g
s|\$secondary_links|$secondary_menu|g
s|\$left|$sidebar_first|g
s|\$right|$sidebar_second|g
s|</body>|<?php print $page_bottom; ?></body>|

Thanks to http://drupaldome.com/how-convert-your-drupal-6-theme-drupal-7-theme for the initial pointers.

See also: http://www.grymoire.com/Unix/Sed.html for how to use sed

Page status

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Audience
Designers/themers, Programmers, Site administrators, Site builders
Level
Intermediate
Keywords
bash, diff drupal 6 themes to drupal 7, sed
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.