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