type) { case 'blog': $vars['submitted'] = clean_blog_date($node); break; } } /** * Override or insert variables into the page templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("page" in this case.) */ function phptemplate_preprocess_page(&$vars, $hook) { $vars['path'] = base_path() . path_to_theme() .'/'; $vars['logo'] = preg_replace('@^'. base_path() .'@', '', $vars['logo']); } /** * Create node classes for node templates files. * * @param $vars * An array of variables to pass to the theme template. * @return $classes * A string of node classes for inserting into the node template. */ function phptemplate_node_classes($vars) { $node = $vars['node']; $classes = 'node node-'. $node->type .' node-'. $node->type .'-'; if ($vars['page']) { $classes .= 'page'; } elseif ($vars['teaser']) { $classes .= 'teaser'; } if ($vars['sticky']) { $classes .= ' sticky'; } if (!$vars['status']) { $classes .= ' node-unpublished'; } return $classes; } /** * Override or insert variables into the comment templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("comment" in this case.) */ function phptemplate_preprocess_comment(&$vars, $hook) { $comment = $vars['comment']; $vars['comment_date'] = clean_comment_date($comment); $vars['comment_classes'] = 'comment'. ($comment->new ? ' comment-new' : ''); $vars['comment_classes'] .= ($comment->status == COMMENT_NOT_PUBLISHED) ? ' comment-unpublished' : ''; $vars['comment_classes'] .= ' '. $vars['zebra'] .' clear-block'; } /** * Formats calendar style dates for blog posts. * * @param $node * The node object from which to extract submitted date information. * @return themed date. */ function clean_blog_date($node) { $day = format_date($node->created, 'custom', "j"); $month = format_date($node->created, 'custom', "M"); $year = format_date($node->created, 'custom', "Y"); $output = ''. $day .''; $output .= ''. $month .''; $output .= ''. $year .''; return $output; } /** * Formats calendar style dates for comments. * * @param $comment * The comment object from which to extract submitted date information. * @return themed date. */ function clean_comment_date($comment) { $day = format_date($comment->timestamp, 'custom', 'd M'); $time = format_date($comment->timestamp, 'custom', 'H:i'); $output = ''. $day .''; $output .= ''. $time .''; return $output; }