source: themes/yd/yd.theme @ 110

Revision 110, 6.2 KB checked in by nigel, 5 years ago (diff)
  • Changed date format to not have a leading 0
Line 
1<?php
2// $Id: yd.theme,v 1.44 2006/04/15 04:07:18 unconed Exp $
3
4/**
5 * @file
6 * A slim, CSS-driven theme.
7 */
8
9function yd_features() {
10  return array(
11       'toggle_logo',
12       'toggle_favicon',
13       'toggle_name',
14       'toggle_slogan');
15}
16
17function yd_regions() {
18  return array(
19       'left' => t('left sidebar'),
20       'right' => t('right sidebar')
21  );
22}
23
24function yd_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  $output .= "<div style='float:left;background-image: url(\"".base_path().path_to_theme()."/logo.png\"); background-repeat: no-repeat; background-position: top right; width:100%; height:90px; background-color:white;'>";
51  if (theme_get_setting('toggle_name')) {
52    $output .= "<span style='font-family: serif;'><a href=\"". base_path() ."\" title=\"". t('Home') ."\"><span STYLE='color:#F70000; font-size:30px; '>your</span><span STYLE='color:#38177A; font-size:30px;'>democracy</span><span STYLE='color:#797979; font-size:30px;'>.net.au</span></a></span>";
53    //$output .= "  <h1 class=\"site-name title\">". l(variable_get('site_name', 'drupal'), ""). "</h1>";
54  }
55  if (theme_get_setting('toggle_slogan')) {
56    $output .= "  <div class=\"site-slogan\">". variable_get('site_slogan', '') ."</div>";
57  }
58  $output .= "</div>";
59  if ($logo = theme_get_setting('logo')) {
60    $output .= "<div style='float:right;'>  <a href=\"". base_path() ."\" title=\"". t('Home') ."\"><img src=\"$logo\" alt=\"". t('Home') ."\" /></a></div>";
61  }
62
63  $output .= "</div>\n";
64
65  $primary_links = theme('links', menu_primary_links(), array('class' => 'links', 'id' => 'navlist'));
66  $secondary_links = theme('links', menu_secondary_links(), array('class' => 'links', 'id' => 'subnavlist'));
67  if (isset($primary_links) || isset($secondary_links)) {
68    $output .= ' <div class="navlinks">';
69    if (isset($primary_links)) {
70//      $output .= '<div class="primary">'. $primary_links .'</div>';
71    }
72    if (isset($secondary_links)) {
73//      $output .= '<div class="secondary">'. $secondary_links .'</div>';
74    }
75    $output .= " </div>\n";
76  }
77  $output .= "<div style='float:right;' id='date'>".format_date(time(), "custom", "l jS \of F Y")."</div>";
78
79  $output .= " <table id=\"content\">\n";
80  $output .= "  <tr>\n";
81
82  if ($show_blocks && !empty($blocks_left)) {
83    $output .= "   <td id=\"sidebar-left\">$blocks_left</td>\n";
84  }
85
86  $output .= "   <td id=\"main\">\n";
87
88  if ($title) {
89    $output .= theme("breadcrumb", drupal_get_breadcrumb());
90    $output .= "<h2>$title</h2>";
91  }
92
93  if ($tabs = theme('menu_local_tasks')) {
94    $output .= $tabs;
95  }
96
97  $output .= theme('help');
98
99  $output .= theme('status_messages');
100
101  $output .= "\n<!-- begin content -->\n";
102  $output .= $content;
103  $output .= drupal_get_feeds();
104  $output .= "\n<!-- end content -->\n";
105
106  if ($footer = variable_get('site_footer', '')) {
107    $output .= " <div id=\"footer\">$footer</div>\n";
108  }
109
110  $output  .= "   </td>\n";
111
112  if ($show_blocks && !empty($blocks_right)) {
113    $output .= "   <td id=\"sidebar-right\">$blocks_right</td>\n";
114  }
115
116  $output .= "  </tr>\n";
117  $output .= " </table>\n";
118
119  $output .=  theme_closure();
120
121  $output .= " </body>\n";
122  $output .= "</html>\n";
123
124  return $output;
125}
126
127function yd_node($node, $teaser = 0, $page = 0) {
128
129  $output  = "<div class=\"node". ((!$node->status) ? ' node-unpublished' : '') ."\">\n";
130
131  if (!$page) {
132    $output .= " <h2 class=\"title\">". ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) ."</h2>\n";
133  }
134
135  $output .= " <div class=\"content\">\n";
136
137  if ($teaser && $node->teaser) {
138    $output .= $node->teaser;
139  }
140  else {
141    $output .= $node->body;
142  }
143
144  $output .= " </div>\n";
145
146  $submitted['node_submitted'] = theme_get_setting("toggle_node_info_$node->type") ? array(
147    'title' => t("By !author at @date", array('!author' => theme('username', $node), '@date' => format_date($node->created, 'small'))),
148    'html' => TRUE) : array();
149
150  $terms = array();
151  if (module_exists('taxonomy')) {
152    $terms = taxonomy_link("taxonomy terms", $node);
153  }
154
155  $links = array_merge($submitted, $terms);
156  if ($node->links) {
157    $links = array_merge($links, $node->links);
158  }
159  if (count($links)) {
160    $output .= '<div class="links">'. theme('links', $links, array('class' => 'links inline')) ."</div>\n";
161  }
162
163  $output .= "</div>\n";
164
165  return $output;
166}
167
168function yd_comment($comment, $links = "") {
169  $submitted['comment_submitted'] = array(
170    'title' => t('By !author at @date', array('!author' => theme('username', $comment), '@date' => format_date($comment->timestamp, 'small'))),
171    'html' => TRUE);
172  $output  = "<div class=\"comment". ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') ."\">\n";
173  $output .= " <h3 class=\"title\">". l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid") ."</h3>\n";
174  $output .= " <div class=\"content\">". $comment->comment ."</div>\n";
175  $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $links)) ."</div>\n";
176  $output .= "</div>\n";
177
178  return $output;
179}
180
181function yd_help() {
182  if ($help = menu_get_active_help()) {
183    return '<div class="help">'. $help .'</div><hr />';
184  }
185}
186
187?>
Note: See TracBrowser for help on using the repository browser.