wesley tanaka

Converting a Drupal 5.x theme to 6.x

1) Create an .info file

Create a themename.info file in your theme directory, which should look something like this:

name = Human-Readable Theme Name
description = One sentence description of theme.
core = 6.x
engine = phptemplate
The core variable should match the value of DRUPAL_CORE_COMPATIBILITY which is defined in modules/system/system.module

2) Get Drupal to notice the theme

If you create the .info file after running update.php, Drupal will not immediately notice that it has been created. Visit admin/build/themes to refresh.

3) Replace variables

Make sure that none of your variables are named $left, $right, or $footer, and then make the following replacements:

  1. $sidebar_left has become $left
  2. $sidebar_right has become $right
  3. $footer_message has become $footer, but when you output it, it should be echo $footer_message . $footer
  4. $language has become $language->language
  5. If you were using $base_path as a link to the front page, you can now use $front_page instead (which contains url(NULL))
  6. if ($messages) print $messages; has become if ($show_messages && $messages) print $messages;

4) Add $signature to comment.tpl.php

Add an echo $signature; after $content is output. The Drupal Handbook also provides a way to avoid double printing signatures on comments created in 5.x and before.

5) Get rid of _phptemplate_callback() if you use it

It is no longer supported.

6) (Optional) Replace theme_some_thing() with some-thing.tpl.php

If your theme's template file defines any mytheme_something() or phptemplate_something() functions, you can optionally remove each of those functions and put its content in a separate .tpl.php file in your theme's directory or any subdirectory thereof. (I think. Still looking into this)

A note about clearing/rebuilding the theme registry

You need to rebuild the theme registry every time a .tpl.php file is created, removed, moved or renamed. You do not need to rebuild the theme registry if the contents of a .tpl.php file changes. To rebuild/clear the theme registry (Drupal 6.0) simply visit or reload the modules page admin/build/modules

7) (Optional) Take advantage of new functionality

Suggested Links

Totally awesome work

This guideline is extremely useful, thorough, and well-organized.

Thank you verrry much for putting this up.

excellent - is it really that easy?

if i wanted to, for example, convert the spreadfirefox theme to d6, could i simply do a global find and replace based on what you've described above, copy and paste your code for .info (but call it spreadfirefox) and then just upload and it would work? it seems like there's so much more to this...

Great work !!! Very helpful

Great work !!!

Very helpful

Thanks for this really short

Thanks for this really short but useful "recipe".

Primary Menu missing

Thanks very much for this page, just an extra note for those who have issues with primary links now showing up after updating. In your pages template file you will have a line like ' print theme('menu_links', $primary_links, ' ... To make it work under 6.x all you have to do is change 'menu_links' to 'links'. Hopefully this helps some one like this page helped me.

themename_comment($comment,

themename_comment($comment, $links = array())

should be redefined to themename_comment($comment, $node, $links = array())

it took me a few days to figure this out.

the line who is respondsable for this is line 1580 in comment.module.
the line content:"$output .= theme('comment', $comment, $node, $links);"

I wonder why the comment module still makes a call to theme('comment'...

there is actually no more theme_comment defined in drupal6.

probably I miss something. :(

Thanks!!!

Thanks! This really bailed me out.

aberdeen-liquid theme problem

Thank you very much! This has been a great help for me!

My Aberdeen theme is almost perfect now with Drupal 6.x, just one thing, I'm using Aberdeen-liquid (resizable) and when I select it in Drupal 6.x all of my Website "things" appear in other site, I mean, header OK, left bar OK, but primary links in the footer (instead of in the header), the page content below the primary links (I have to make scroll to see the content...). It seems like the regions had a different size and the header and/or the left bar were displacing the rest of regions.
Any of you imagines what could be happening?

Thank you very much again.

Thanks so much!

This saved me so much time and effort. I really appreciate you posting this. Thanks!

Great tutorial, it works

Great tutorial, it works fine on my blog and saves so much time.

Syndicate content