Mercurial > defr > drupal > core
comparison themes/garland/template.php @ 1:c1f4ac30525a 6.0
Drupal 6.0
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Tue, 23 Dec 2008 14:28:28 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:5a113a1c4740 | 1:c1f4ac30525a |
|---|---|
| 1 <?php | |
| 2 // $Id: template.php,v 1.16 2007/10/11 09:51:29 goba Exp $ | |
| 3 | |
| 4 /** | |
| 5 * Sets the body-tag class attribute. | |
| 6 * | |
| 7 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed. | |
| 8 */ | |
| 9 function phptemplate_body_class($left, $right) { | |
| 10 if ($left != '' && $right != '') { | |
| 11 $class = 'sidebars'; | |
| 12 } | |
| 13 else { | |
| 14 if ($left != '') { | |
| 15 $class = 'sidebar-left'; | |
| 16 } | |
| 17 if ($right != '') { | |
| 18 $class = 'sidebar-right'; | |
| 19 } | |
| 20 } | |
| 21 | |
| 22 if (isset($class)) { | |
| 23 print ' class="'. $class .'"'; | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 /** | |
| 28 * Return a themed breadcrumb trail. | |
| 29 * | |
| 30 * @param $breadcrumb | |
| 31 * An array containing the breadcrumb links. | |
| 32 * @return a string containing the breadcrumb output. | |
| 33 */ | |
| 34 function phptemplate_breadcrumb($breadcrumb) { | |
| 35 if (!empty($breadcrumb)) { | |
| 36 return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>'; | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 /** | |
| 41 * Allow themable wrapping of all comments. | |
| 42 */ | |
| 43 function phptemplate_comment_wrapper($content, $node) { | |
| 44 if (!$content || $node->type == 'forum') { | |
| 45 return '<div id="comments">'. $content .'</div>'; | |
| 46 } | |
| 47 else { | |
| 48 return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>'; | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 /** | |
| 53 * Override or insert PHPTemplate variables into the templates. | |
| 54 */ | |
| 55 function phptemplate_preprocess_page(&$vars) { | |
| 56 $vars['tabs2'] = menu_secondary_local_tasks(); | |
| 57 | |
| 58 // Hook into color.module | |
| 59 if (module_exists('color')) { | |
| 60 _color_page_alter($vars); | |
| 61 } | |
| 62 } | |
| 63 | |
| 64 /** | |
| 65 * Returns the rendered local tasks. The default implementation renders | |
| 66 * them as tabs. Overridden to split the secondary tasks. | |
| 67 * | |
| 68 * @ingroup themeable | |
| 69 */ | |
| 70 function phptemplate_menu_local_tasks() { | |
| 71 return menu_primary_local_tasks(); | |
| 72 } | |
| 73 | |
| 74 function phptemplate_comment_submitted($comment) { | |
| 75 return t('!datetime — !username', | |
| 76 array( | |
| 77 '!username' => theme('username', $comment), | |
| 78 '!datetime' => format_date($comment->timestamp) | |
| 79 )); | |
| 80 } | |
| 81 | |
| 82 function phptemplate_node_submitted($node) { | |
| 83 return t('!datetime — !username', | |
| 84 array( | |
| 85 '!username' => theme('username', $node), | |
| 86 '!datetime' => format_date($node->created), | |
| 87 )); | |
| 88 } | |
| 89 | |
| 90 /** | |
| 91 * Generates IE CSS links for LTR and RTL languages. | |
| 92 */ | |
| 93 function phptemplate_get_ie_styles() { | |
| 94 global $language; | |
| 95 | |
| 96 $iecss = '<link type="text/css" rel="stylesheet" media="all" href="'. base_path() . path_to_theme() .'/fix-ie.css" />'; | |
| 97 if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { | |
| 98 $iecss .= '<style type="text/css" media="all">@import "'. base_path() . path_to_theme() .'/fix-ie-rtl.css";</style>'; | |
| 99 } | |
| 100 | |
| 101 return $iecss; | |
| 102 } |
