[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/themes/chameleon/ -> chameleon.theme (source)

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


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7