chameleon.theme

  1. drupal
    1. 4.6 themes/chameleon/chameleon.theme
    2. 4.7 themes/chameleon/chameleon.theme
    3. 5 themes/chameleon/chameleon.theme
    4. 6 themes/chameleon/chameleon.theme

A slim, CSS-driven theme.

Functions & methods

NameDescription
chameleon_comment
chameleon_features
chameleon_help
chameleon_node
chameleon_page
chameleon_regions

File

themes/chameleon/chameleon.theme
View source
  1. /**
  2. * @file
  3. * A slim, CSS-driven theme.
  4. */
  5. function chameleon_features() {
  6. return array(
  7. 'toggle_logo',
  8. 'toggle_favicon',
  9. 'toggle_name',
  10. 'toggle_slogan');
  11. }
  12. function chameleon_regions() {
  13. return array(
  14. 'left' => t('left sidebar'),
  15. 'right' => t('right sidebar')
  16. );
  17. }
  18. function chameleon_page($content) {
  19. $language = $GLOBALS['locale'];
  20. if (theme_get_setting('toggle_favicon')) {
  21. drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
  22. }
  23. $title = drupal_get_title();
  24. $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
  25. $output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n";
  26. $output .= "<head>\n";
  27. $output .= " <title>". ($title ? strip_tags($title) ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")) ."</title>\n";
  28. $output .= drupal_get_html_head();
  29. $output .= theme('stylesheet_import', base_path() . path_to_theme() ."/common.css");
  30. $output .= theme_get_styles();
  31. $output .= "</head>";
  32. $output .= "<body>\n";
  33. $output .= " <div id=\"header\">";
  34. if ($logo = theme_get_setting('logo')) {
  35. $output .= " <a href=\"". base_path() ."\" title=\"". t('Home') ."\"><img src=\"$logo\" alt=\"". t('Home') ."\" /></a>";
  36. }
  37. if (theme_get_setting('toggle_name')) {
  38. $output .= " <h1 class=\"site-name title\">". l(variable_get('site_name', 'drupal'), ""). "</h1>";
  39. }
  40. if (theme_get_setting('toggle_slogan')) {
  41. $output .= " <div class=\"site-slogan\">". variable_get('site_slogan', '') ."</div>";
  42. }
  43. $output .= "</div>\n";
  44. $primary_links = theme('links', menu_primary_links());
  45. $secondary_links = theme('links', menu_secondary_links());
  46. if (isset($primary_links) || isset($secondary_links)) {
  47. $output .= ' <div class="navlinks">';
  48. if (isset($primary_links)) {
  49. $output .= '<div class="primary">'. $primary_links .'</div>';
  50. }
  51. if (isset($secondary_links)) {
  52. $output .= '<div class="secondary">'. $secondary_links .'</div>';
  53. }
  54. $output .= " </div>\n";
  55. }
  56. $output .= " <table id=\"content\">\n";
  57. $output .= " <tr>\n";
  58. if ($blocks = theme_blocks("left")) {
  59. $output .= " <td id=\"sidebar-left\">$blocks</td>\n";
  60. }
  61. $output .= " <td id=\"main\">\n";
  62. if ($title) {
  63. $output .= theme("breadcrumb", drupal_get_breadcrumb());
  64. $output .= "<h2>$title</h2>";
  65. }
  66. if ($tabs = theme('menu_local_tasks')) {
  67. $output .= $tabs;
  68. }
  69. $output .= theme('help');
  70. $output .= theme('status_messages');
  71. $output .= "\n<!-- begin content -->\n";
  72. $output .= $content;
  73. $output .= "\n<!-- end content -->\n";
  74. if ($footer = variable_get('site_footer', '')) {
  75. $output .= " <div id=\"footer\">$footer</div>\n";
  76. }
  77. $output .= " </td>\n";
  78. if ($blocks = theme_blocks("right")) {
  79. $output .= " <td id=\"sidebar-right\">$blocks</td>\n";
  80. }
  81. $output .= " </tr>\n";
  82. $output .= " </table>\n";
  83. $output .= theme_closure();
  84. $output .= " </body>\n";
  85. $output .= "</html>\n";
  86. return $output;
  87. }
  88. function chameleon_node($node, $teaser = 0, $page = 0) {
  89. $output = "<div class=\"node". ((!$node->status) ? ' node-unpublished' : '') ."\">\n";
  90. if (!$page) {
  91. $output .= " <h2 class=\"title\">". ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) ."</h2>\n";
  92. }
  93. $output .= " <div class=\"content\">\n";
  94. if ($teaser && $node->teaser) {
  95. $output .= $node->teaser;
  96. }
  97. else {
  98. $output .= $node->body;
  99. }
  100. $output .= " </div>\n";
  101. $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();
  102. $terms = array();
  103. if (module_exist('taxonomy')) {
  104. $terms = taxonomy_link("taxonomy terms", $node);
  105. }
  106. $links = array_merge($submitted, $terms);
  107. if ($node->links) {
  108. $links = array_merge($links, $node->links);
  109. }
  110. if (count($links)) {
  111. $output .= " <div class=\"links\">". theme('links', $links) ."</div>\n";
  112. }
  113. $output .= "</div>\n";
  114. return $output;
  115. }
  116. function chameleon_comment($comment, $links = "") {
  117. $submitted = array(t('By %author at %date', array('%author' => theme('username', $comment), '%date' => format_date($comment->timestamp, 'small'))));
  118. $output = "<div class=\"comment". ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') ."\">\n";
  119. $output .= " <h3 class=\"title\">". l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") ."</h3>\n";
  120. $output .= " <div class=\"content\">". $comment->comment ."</div>\n";
  121. $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $links)) ."</div>\n";
  122. $output .= "</div>\n";
  123. return $output;
  124. }
  125. function chameleon_help() {
  126. if ($help = menu_get_active_help()) {
  127. return '<div class="help">'. $help .'</div><hr />';
  128. }
  129. }
Login or register to post comments