[ Index ] |
|
Code source de Drupal 5.3 |
1 <?php 2 // $Id: chameleon.theme,v 1.56.2.2 2007/05/31 06:13:36 drumm Exp $ 3 4 /** 5 * @file 6 * A slim, CSS-driven theme which does not depend on a template engine like phptemplate 7 */ 8 9 function chameleon_features() { 10 return array( 11 'toggle_logo', 12 'toggle_favicon', 13 'toggle_name', 14 'toggle_slogan'); 15 } 16 17 function chameleon_regions() { 18 return array( 19 'left' => t('left sidebar'), 20 'right' => t('right sidebar') 21 ); 22 } 23 24 function chameleon_page($content, $show_blocks = TRUE) { 25 $language = $GLOBALS['locale']; 26 27 if (theme_get_setting('toggle_favicon')) { 28 drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />'); 29 } 30 31 drupal_add_css(path_to_theme() .'/common.css', 'theme'); 32 33 $title = drupal_get_title(); 34 35 // Get blocks before so that they can alter the header (JavaScript, Stylesheets etc.) 36 $blocks_left = theme_blocks('left'); 37 $blocks_right = theme_blocks('right'); 38 39 $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"; 40 $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n"; 41 $output .= "<head>\n"; 42 $output .= " <title>". ($title ? strip_tags($title) ." | ". variable_get("site_name", "Drupal") : variable_get("site_name", "Drupal") ." | ". variable_get("site_slogan", "")) ."</title>\n"; 43 $output .= drupal_get_html_head(); 44 $output .= drupal_get_css(); 45 $output .= drupal_get_js(); 46 $output .= "</head>"; 47 $output .= "<body>\n"; 48 $output .= " <div id=\"header\">"; 49 50 if ($logo = theme_get_setting('logo')) { 51 $output .= " <a href=\"". base_path() ."\" title=\"". t('Home') ."\"><img src=\"$logo\" alt=\"". t('Home') ."\" /></a>"; 52 } 53 if (theme_get_setting('toggle_name')) { 54 $output .= " <h1 class=\"site-name title\">". l(variable_get('site_name', 'drupal'), ""). "</h1>"; 55 } 56 if (theme_get_setting('toggle_slogan')) { 57 $output .= " <div class=\"site-slogan\">". variable_get('site_slogan', '') ."</div>"; 58 } 59 60 $output .= "</div>\n"; 61 62 $primary_links = theme('links', menu_primary_links(), array('class' => 'links', 'id' => 'navlist')); 63 $secondary_links = theme('links', menu_secondary_links(), array('class' => 'links', 'id' => 'subnavlist')); 64 if (isset($primary_links) || isset($secondary_links)) { 65 $output .= ' <div class="navlinks">'; 66 if (isset($primary_links)) { 67 $output .= $primary_links; 68 } 69 if (isset($secondary_links)) { 70 $output .= $secondary_links; 71 } 72 $output .= " </div>\n"; 73 } 74 75 $output .= " <table id=\"content\">\n"; 76 $output .= " <tr>\n"; 77 78 if ($show_blocks && !empty($blocks_left)) { 79 $output .= " <td id=\"sidebar-left\">$blocks_left</td>\n"; 80 } 81 82 $output .= " <td id=\"main\">\n"; 83 84 if ($title) { 85 $output .= theme("breadcrumb", drupal_get_breadcrumb()); 86 $output .= "<h2>$title</h2>"; 87 } 88 89 if ($tabs = theme('menu_local_tasks')) { 90 $output .= $tabs; 91 } 92 93 $output .= theme('help'); 94 95 $output .= theme('status_messages'); 96 97 $output .= "\n<!-- begin content -->\n"; 98 $output .= $content; 99 $output .= drupal_get_feeds(); 100 $output .= "\n<!-- end content -->\n"; 101 102 if ($footer = variable_get('site_footer', '')) { 103 $output .= " <div id=\"footer\">$footer</div>\n"; 104 } 105 106 $output .= " </td>\n"; 107 108 if ($show_blocks && !empty($blocks_right)) { 109 $output .= " <td id=\"sidebar-right\">$blocks_right</td>\n"; 110 } 111 112 $output .= " </tr>\n"; 113 $output .= " </table>\n"; 114 115 $output .= theme_closure(); 116 $output .= " </body>\n"; 117 $output .= "</html>\n"; 118 119 return $output; 120 } 121 122 function chameleon_node($node, $teaser = 0, $page = 0) { 123 124 $output = "<div class=\"node". ((!$node->status) ? ' node-unpublished' : '') ."\">\n"; 125 126 if (!$page) { 127 $output .= " <h2 class=\"title\">". ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) ."</h2>\n"; 128 } 129 130 $output .= " <div class=\"content\">\n"; 131 132 if ($teaser && $node->teaser) { 133 $output .= $node->teaser; 134 } 135 else { 136 $output .= $node->body; 137 } 138 139 $output .= " </div>\n"; 140 141 if (theme_get_setting("toggle_node_info_$node->type")) { 142 $submitted['node_submitted'] = array( 143 'title' => t("By !author at @date", array('!author' => theme('username', $node), '@date' => format_date($node->created, 'small'))), 144 'html' => TRUE, 145 ); 146 } 147 else { 148 $submitted['node_submitted'] = array(); 149 } 150 151 $terms = array(); 152 if (module_exists('taxonomy')) { 153 $terms = taxonomy_link("taxonomy terms", $node); 154 } 155 156 $links = array_merge($submitted, $terms); 157 if ($node->links) { 158 $links = array_merge($links, $node->links); 159 } 160 if (count($links)) { 161 $output .= '<div class="links">'. theme('links', $links, array('class' => 'links inline')) ."</div>\n"; 162 } 163 164 $output .= "</div>\n"; 165 166 return $output; 167 } 168 169 function chameleon_comment($comment, $links = "") { 170 $submitted['comment_submitted'] = array( 171 'title' => t('By !author at @date', array('!author' => theme('username', $comment), '@date' => format_date($comment->timestamp, 'small'))), 172 'html' => TRUE, 173 ); 174 175 $output = "<div class=\"comment". ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') ."\">\n"; 176 $output .= " <h3 class=\"title\">". l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") ."</h3>\n"; 177 $output .= " <div class=\"content\">". $comment->comment ."</div>\n"; 178 $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $links)) ."</div>\n"; 179 $output .= "</div>\n"; 180 181 return $output; 182 } 183 184 function chameleon_help() { 185 if ($help = menu_get_active_help()) { 186 return '<div class="help">'. $help .'</div><hr />'; 187 } 188 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Nov 30 16:20:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |