Drupal theming - Converting drupal 5x theme to drupal 6x
For converting an existing drupal5 theme to drupal6 theme you can follow these steps:-
=>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:
$sidebar_lefthas become$left$sidebar_righthas become$right$footer_messagehas become$footer, but when you output it, it should beecho $footer_message . $footer$languagehas become$language->language- If you were using
$base_pathas a link to the front page, you can now use$front_pageinstead (which containsurl(NULL)) if ($messages) print $messages;has becomeif ($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
- Customize your theme's admin/settings page
- $body_classes can be more powerful than $layout
- Themes can override Drupal's css files and css files from modules
- Include right-to-left-specific css files (also see an example use of the new
$language->dirinthemes/garland/page.tpl.php) - use any updated jQuery 1.2.3 functionality
- Submitted by user on date/time is themable
- script.js in the theme directory is included automatically
- Drupal now has a javascript function overriding mechanism
- Printer-friendly version
- Login or register to post comments
Delicious
Digg
StumbleUpon
Facebook
Google
Yahoo
Technorati
Icerocket

Sign In





