Viewing file: template.php (5.1 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php // $Id: template.php,v 1.13 2008/05/13 09:19:13 johnalbin Exp $
/** * @file * * OVERRIDING THEME FUNCTIONS * * The Drupal theme system uses special theme functions to generate HTML output * automatically. Often we wish to customize this HTML output. To do this, we * have to override the theme function. You have to first find the theme * function that generates the output, and then "catch" it and modify it here. * The easiest way to do it is to copy the original function in its entirety and * paste it here, changing the prefix from theme_ to STARTERKIT_. For example: * * original: theme_breadcrumb() * theme override: STARTERKIT_breadcrumb() * * where STARTERKIT is the name of your sub-theme. For example, the zen_classic * theme would define a zen_classic_breadcrumb() function. * * If you would like to override any of the theme functions used in Zen core, * you should first look at how Zen core implements those functions: * theme_breadcrumbs() in zen/template.php * theme_menu_item_link() in zen/template-menus.php * theme_menu_local_tasks() in zen/template-menus.php */
/* * Add any conditional stylesheets you will need for this sub-theme. * * To add stylesheets that ALWAYS need to be included, you should add them to * your .info file instead. Only use this section if you are including * stylesheets based on certain conditions. */
/* -- Delete this line if you want to use and modify this code // Example: optionally add a fixed width CSS file. if (theme_get_setting('STARTERKIT_fixed')) { drupal_add_css(path_to_theme() . '/layout-fixed.css', 'theme', 'all'); } // */
/** * Implementation of HOOK_theme(). */ function STARTERKIT_theme(&$existing, $type, $theme, $path) { return zen_theme($existing, $type, $theme, $path); }
/** * Override or insert PHPTemplate variables into all templates. * * @param $vars * A sequential array of variables to pass to the theme template. * @param $hook * The name of the theme function being called (name of the .tpl.php file.) */ /* -- Delete this line if you want to use this function function STARTERKIT_preprocess(&$vars, $hook) { $vars['sample_variable'] = t('Lorem ipsum.'); } // */
/** * Override or insert PHPTemplate variables into the page templates. * * @param $vars * A sequential array of variables to pass to the theme template. * @param $hook * The name of the theme function being called ("page" in this case.) */ /* -- Delete this line if you want to use this function function STARTERKIT_preprocess_page(&$vars, $hook) { $vars['sample_variable'] = t('Lorem ipsum.'); } // */
/** * Override or insert PHPTemplate variables into the node templates. * * @param $vars * A sequential array of variables to pass to the theme template. * @param $hook * The name of the theme function being called ("node" in this case.) */ /* -- Delete this line if you want to use this function function STARTERKIT_preprocess_node(&$vars, $hook) { $vars['sample_variable'] = t('Lorem ipsum.'); } // */
/** * Override or insert PHPTemplate variables into the comment templates. * * @param $vars * A sequential array of variables to pass to the theme template. * @param $hook * The name of the theme function being called ("comment" in this case.) */ /* -- Delete this line if you want to use this function function STARTERKIT_preprocess_comment(&$vars, $hook) { $vars['sample_variable'] = t('Lorem ipsum.'); } // */
/** * Override or insert PHPTemplate variables into the block templates. * * @param $vars * A sequential array of variables to pass to the theme template. * @param $hook * The name of the theme function being called ("block" in this case.) */ /* -- Delete this line if you want to use this function function STARTERKIT_preprocess_block(&$vars, $hook) { $vars['sample_variable'] = t('Lorem ipsum.'); } // */
/** * The rel="nofollow" attribute is missing from anonymous users' URL in Drupal 6.0-6.2. */ /* -- Delete this line if you want to use this function function STARTERKIT_username($object) {
if ($object->uid && $object->name) { // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->name) > 20) { $name = drupal_substr($object->name, 0, 15) . '...'; } else { $name = $object->name; }
if (user_access('access user profiles')) { $output = l($name, 'user/' . $object->uid, array('attributes' => array('title' => t('View user profile.')))); } else { $output = check_plain($name); } } else if ($object->name) { // Sometimes modules display content composed by people who are // not registered members of the site (e.g. mailing list or news // aggregator modules). This clause enables modules to display // the true author of the content. if (!empty($object->homepage)) { $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); } else { $output = check_plain($object->name); }
$output .= ' (' . t('not verified') . ')'; } else { $output = variable_get('anonymous', t('Anonymous')); }
return $output; } // */
|