Upgrading your custom theme

Now we need to add our custom theme back to the site. Our theme is called 'Apollo' and we originally used the Zen Themer's Starter Kit files in Drupal 5.x to create this custom theme. Here are the steps for upgrading our custom theme to Drupal 6.x and for using the new upgraded Zen Themer's Starter Kit code base. Bear in mind that we did not make any template code edits to our original Apollo theme, so we do not need to worry about updating our new template files with our existing template code. This may be different in your specific case. Make sure to have good backups of all your existing Drupal 5.x custom theme files. We will need to copy over the CSS files from our existing Apollo theme, so we have the same CSS styles in our new 6.x site. Here are the steps:

1. Copy over your existing apollo folder using FTP into the main Zen directory in your /sites/all/modules folder.

2. Open the apollo folder on the remote side and delete the following files: template.php, theme-settings.php, and theme-settings.init.php. These are the older template files and we will replace these with the latest TPL versions—make sure you note down any specific theme override functions you may have customized or added—you can copy those out and then paste them back into the new TPL files once you add them. In our case, we did not add any specific theme overrides.

3. Now, with Drupal 6.x themes the new rule is that you need to have a .info file in your theme directory, so that the theme will show up in the modules admin list, and in order for all of your theme regions to be defined properly. You need to add an apollo.info file in the root directory of the theme. Copy the STARTERKIT.info file (from the starterkit theme folder) to your local side of FTP. Open the file in WordPad, and change any reference to starterkit in the file to apollo.

1

STARTERKIT.info - WordPad

□0®

| File Edit View Insert Format Help |

| □ at h m a #4 s % e, v<j

; $ Id: apollo.info,v 1.13.2.1 2009/02/13 06:13:18 johnalbin Exp $ ^

; $ Id: apollo.info,v 1.13.2.1 2009/02/13 06:13:18 johnalbin Exp $ ^

Change to apollo.info

; The name and description of the theme used on the admin/buiId/themes page, name = Apollo change to Apollo description = Read the <a href="http://drupal.org/node/2 26507">online docs</a> on how to create s

; The screenshot used on the admin/buiId/themes page, screenshot = screenshot.png

; "core" specifies the version of Drupal that this theme is compatible with. ; "base theme" specifies that this is a theme that uses the "zen" theme as its ; base theme. Its unlikely you will ever need to change these, but they are ; required fields for a Zen sub-theme. The "engine" field is not used in a ; sub-theme since the engine is inherited from its base theme, core = 6.x base theme = zen

; This section adds C55 files to your theme. The media type is specified in ; the brackets. Typical CSS media types include "all", "screen", "print", and ; "handheld". See http://www.w3.Org/TR/CSS21/media.html#media-types for a full ; list of stylesheet media types in CSS 2.1.

; You can also override any of Zen's stylesheets or any module's stylesheets, ; an /extremely/ useful feature. See the excellent Drupal 6 Theme Guide at ; http://drupal.org/node/171209 for more details.| stylesheets[al1][] = layout.ess stylesheets[al1][] = html-elements.ess ; stylesheets[all] [] = tabs.ess ; stylesheets[all][] = messages.ess ; stylesheets[all][] = block-editing.ess ; stylesheets[all][] = wireframes.ess stylesheets [all] [] = apollo. ess change to apollo.CSS stylesheets[print][] = print.ess

; To prevent stylesheets of a base theme or of a module from being included in ; our sub-theme, we specify it in our .info file (and we don1t need to have a ; stylesheet in our sub-theme with that name.) For example, we prevent the ; zen.ess file in the base theme from being included by specifying it here, stylesheets[all] [] = zen.ess

For_Helpj press F1

4. Save the file and then re-name it to apollo.info. Upload this apollo.info file back to your apollo theme directory.

5. Refresh your themes admin list and the Apollo theme will now be visible.

6. Grab the template.php file and the theme-settings.php files from the starterkit folder and move those to your local site. Rename any instance of starterkit in those 2 files to apollo. This includes the main function in template.php (function apollo_theme): /**

function apollo_theme(&$existing, $type, $theme, $path) { $hooks = zen_theme($existing, $type, $theme, $path);

$hooks['hook_name_here'] = array( // Details go here ); */

// @TODO: Needs detailed comments. Patches welcome! return $hooks;

This is the renamed function in theme-settings.php:

function apollo_settings($saved_settings) {

// Get the default values from the .info file. $defaults = zen_theme_get_default_settings('apollo');

// Merge the saved variables and their default values.

$settings = array_merge($defaults, $saved_settings); /*

* Create the form using Forms API: http://api.drupal.org/api/6 */

7. Once those functions are renamed, upload those two PHP files to your /apollo directory.

8. Refresh your themes admin listing.

9. Enable your Apollo theme as the Default.

10. Confirm that your Garland theme is set to the default admin theme here: Administer | Site Configuration | Administration theme. You can also choose whether you want to use the Garland theme for content editing. Save configuration.

11. Congratulations! You've upgraded your custom theme to Drupal 6.x. Good work!

0 0

Post a comment