Port to Drupal 6

lut4rp - May 1, 2008 - 15:37
Project:Blommor01
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:frjo
Status:closed
Description

This theme needs to be ported to Drupal 6. Since I shall be using a modded version for my personal website, i shall try and port it myself. Anyone interested in helping can ping me.

#1

frjo - July 5, 2008 - 22:08

When I update my own site to Drupal 6 I will update this theme also. It should be before the end of the year.

#2

lut4rp - July 8, 2008 - 14:03
Assigned to:lut4rp» Anonymous

#3

SteveJB - August 2, 2008 - 16:31

I got most of the update ready.

I just need to swap out the old template.php code with the updated code. Old code:

function _phptemplate_variables($hook, $vars) {
  switch ($hook) {
    case 'page':
      drupal_add_css($vars['directory'] .'/modules.css', 'theme', 'all');
      drupal_add_css($vars['directory'] .'/blommor.css', 'theme', 'all');
      $vars['styles'] = drupal_get_css();
      break;
    case 'node':
      // Display info only on certain node types.
      if (theme_get_setting('toggle_node_info_' . $vars['node']->type)) {
        $vars['submitted'] =  t('!user - <abbr class="created" title="!microdate">!date</abbr>', array(
          '!user' => theme('username', $vars['node']),
          '!date' => format_date($vars['node']->created),
          '!microdate' => format_date($vars['node']->created,'custom', "Y-m-d\TH:i:sO")
        ));
      }
      else {
        $vars['submitted'] = '';
      }
      if (module_exists('taxonomy')) {
        $vocabs = taxonomy_get_vocabularies();
        foreach($vocabs as $vocab) {
          $tags = array();
          $terms = taxonomy_node_get_terms_by_vocabulary($vars['node']->nid, $vocab->vid);
          foreach ($terms as $term) {
            $tags['taxonomy_term_'. $term->tid] = array(
              'title' => $term->name,
              'href' => taxonomy_term_path($term),
              'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
            );
          }
          if ($tags) {
            $vars['tags_'. $vocab->vid] = theme('links', $tags, array('class' => 'links inline'));
          }
        }
      }
      break;

    case 'comment':
      if ($vars['submitted']) {
        $vars['submitted'] =  t('!user - <abbr class="created" title="!microdate">!date</abbr>', array(
          '!user' => theme('username', $vars['comment']),
          '!date' => format_date($vars['comment']->timestamp),
          '!microdate' => format_date($vars['comment']->timestamp,'custom', "Y-m-d\TH:i:sO")
        ));
      }
      break;
  }

  return $vars;
}

My first attempt at updating the template.php file (I'm not that familiar with theme functions:)

function template_preprocess_hook(&$vars) {
  switch ($hook) {
    case 'page':
      drupal_add_css($vars['directory'] .'/modules.css', 'theme', 'all');
      drupal_add_css($vars['directory'] .'/blommor.css', 'theme', 'all');
      $vars['styles'] = drupal_get_css();
      break;
    case 'node':
      // Display info only on certain node types.
      if (theme_get_setting('toggle_node_info_' . $vars['node']->type)) {
        $vars['submitted'] =  t('!user - <abbr class="created" title="!microdate">!date</abbr>', array(
          '!user' => theme('username', $vars['node']),
          '!date' => format_date($vars['node']->created),
          '!microdate' => format_date($vars['node']->created,'custom', "Y-m-d\TH:i:sO")
        ));
      }
      else {
        $vars['submitted'] = '';
      }
      if (module_exists('taxonomy')) {
        $vocabs = taxonomy_get_vocabularies();
        foreach($vocabs as $vocab) {
          $tags = array();
          $terms = taxonomy_node_get_terms_by_vocabulary($vars['node']->nid, $vocab->vid);
          foreach ($terms as $term) {
            $tags['taxonomy_term_'. $term->tid] = array(
              'title' => $term->name,
              'href' => taxonomy_term_path($term),
              'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description))
            );
          }
          if ($tags) {
            $vars['tags_'. $vocab->vid] = theme('links', $tags, array('class' => 'links inline'));
          }
        }
      }
      break;

    case 'comment':
      if ($vars['submitted']) {
        $vars['submitted'] =  t('!user - <abbr class="created" title="!microdate">!date</abbr>', array(
          '!user' => theme('username', $vars['comment']),
          '!date' => format_date($vars['comment']->timestamp),
          '!microdate' => format_date($vars['comment']->timestamp,'custom', "Y-m-d\TH:i:sO")
        ));
      }
      break;
  }

  return $vars;
}

As of now all I did was add function template_preprocess_hook(&$vars)

#4

frjo - September 12, 2008 - 19:13
Version:5.x-1.1» 6.x-1.x-dev
Assigned to:Anonymous» frjo

I have just committed a 6-dev version of the Blommor01 theme. Please try it out and report back any problems.

#5

frjo - October 16, 2009 - 11:53
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.