2 // $Id: chameleon.theme 144 2007-03-28 07:52:20Z thierry $
6 * A slim, CSS-driven theme.
9 function chameleon_features() {
17 function chameleon_regions() {
19 'left' => t('left sidebar'),
20 'right' => t('right sidebar')
24 function chameleon_page($content) {
25 $language = $GLOBALS['locale'];
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" />');
31 $title = drupal_get_title();
33 $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
34 $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n";
35 $output .= "<head>\n";
36 $output .= " <title>". ($title ? strip_tags($title) ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")) ."</title>\n";
37 $output .= drupal_get_html_head();
38 $output .= theme('stylesheet_import', base_path() . path_to_theme() ."/common.css");
39 $output .= theme_get_styles();
41 $output .= "<body>\n";
42 $output .= " <div id=\"header\">";
44 if ($logo = theme_get_setting('logo')) {
45 $output .= " <a href=\"". base_path() ."\" title=\"". t('Home') ."\"><img src=\"$logo\" alt=\"". t('Home') ."\" /></a>";
47 if (theme_get_setting('toggle_name')) {
48 $output .= " <h1 class=\"site-name title\">". l(variable_get('site_name', 'drupal'), ""). "</h1>";
50 if (theme_get_setting('toggle_slogan')) {
51 $output .= " <div class=\"site-slogan\">". variable_get('site_slogan', '') ."</div>";
54 $output .= "</div>\n";
56 $primary_links = theme('links', menu_primary_links());
57 $secondary_links = theme('links', menu_secondary_links());
58 if (isset($primary_links) || isset($secondary_links)) {
59 $output .= ' <div class="navlinks">';
60 if (isset($primary_links)) {
61 $output .= '<div class="primary">'. $primary_links .'</div>';
63 if (isset($secondary_links)) {
64 $output .= '<div class="secondary">'. $secondary_links .'</div>';
66 $output .= " </div>\n";
69 $output .= " <table id=\"content\">\n";
72 if ($blocks = theme_blocks("left")) {
73 $output .= " <td id=\"sidebar-left\">$blocks</td>\n";
76 $output .= " <td id=\"main\">\n";
79 $output .= theme("breadcrumb", drupal_get_breadcrumb());
80 $output .= "<h2>$title</h2>";
83 if ($tabs = theme('menu_local_tasks')) {
87 $output .= theme('help');
89 $output .= theme('status_messages');
91 $output .= "\n<!-- begin content -->\n";
93 $output .= "\n<!-- end content -->\n";
95 if ($footer = variable_get('site_footer', '')) {
96 $output .= " <div id=\"footer\">$footer</div>\n";
99 $output .= " </td>\n";
101 if ($blocks = theme_blocks("right")) {
102 $output .= " <td id=\"sidebar-right\">$blocks</td>\n";
105 $output .= " </tr>\n";
106 $output .= " </table>\n";
108 $output .= theme_closure();
109 $output .= " </body>\n";
110 $output .= "</html>\n";
115 function chameleon_node($node, $teaser = 0, $page = 0) {
117 $output = "<div class=\"node". ((!$node->status) ? ' node-unpublished' : '') ."\">\n";
120 $output .= " <h2 class=\"title\">". ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) ."</h2>\n";
123 $output .= " <div class=\"content\">\n";
125 if ($teaser && $node->teaser) {
126 $output .= $node->teaser;
129 $output .= $node->body;
132 $output .= " </div>\n";
134 $submitted = theme_get_setting("toggle_node_info_$node->type") ? array(t("By %author at %date", array('%author' => theme('username', $node), '%date' => format_date($node->created, 'small')))) : array();
137 if (module_exist('taxonomy')) {
138 $terms = taxonomy_link("taxonomy terms", $node);
141 $links = array_merge($submitted, $terms);
143 $links = array_merge($links, $node->links);
146 $output .= " <div class=\"links\">". theme('links', $links) ."</div>\n";
149 $output .= "</div>\n";
154 function chameleon_comment($comment, $links = "") {
155 $submitted = array(t('By %author at %date', array('%author' => theme('username', $comment), '%date' => format_date($comment->timestamp. 'small'))));
157 $output = "<div class=\"comment". ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') ."\">\n";
158 $output .= " <h3 class=\"title\">". l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") ."</h3>\n";
159 $output .= " <div class=\"content\">". $comment->comment ."</div>\n";
160 $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $links)) ."</div>\n";
161 $output .= "</div>\n";
166 function chameleon_help() {
167 if ($help = menu_get_active_help()) {
168 return '<div class="help">'. $help .'</div><hr />';