/[drupal]/contributions/themes/igniter/template.php
ViewVC logotype

Contents of /contributions/themes/igniter/template.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Mon Dec 17 23:41:13 2007 UTC (23 months, 1 week ago) by gagarine
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
Initial commit of igniter theme. This is a starting theme like zen or base but with a different target.
Igniter are minimal CSS and XHTML for poeple whe would like a "clean" theme.
For keep CSS file smal and reanding fast, comment are not present to big.
1 <?php
2 function igniter_regions() {
3 return array(
4 'left' => t('left sidebar'),
5 'right' => t('right sidebar'),
6 'navbar' => t('navigation bar'),
7 'content_top' => t('content top'),
8 'content_bottom' => t('content bottom'),
9 'pre_header' => t('pre header'),
10 'header' => t('header'),
11 'footer' => t('footer'),
12 'closure_region' => t('closure'),
13 );
14 }
15
16 /**
17 * Intercept template variables
18 *
19 * @param $hook
20 * The name of the theme function being executed (name of the .tpl.php file)
21 * @param $vars
22 * A copy of the array containing the variables for the hook.
23 * @return
24 * The array containing additional variables to merge with $vars.
25 */
26 function _phptemplate_variables($hook, $vars = array()) {
27 // Get the currently logged in user
28 global $user;
29
30 // Set a new $is_admin variable. This is determined by looking at the
31 // currently logged in user and seeing if they are in the role 'admin'. The
32 // 'admin' role will need to have been created manually for this to work this
33 // variable is available to all templates.
34 $vars['is_admin'] = in_array('admin', $user->roles);
35
36 switch ($hook) {
37 case 'page':
38 global $theme, $theme_key;
39
40 // If we're in the main theme
41 if ($theme == $theme_key) {
42 // Avoid IE5 bug that always loads @import print stylesheets
43 $vars['head'] = igniter_add_print_css($vars['directory'] .'/print.css');
44 }
45 break;
46 }
47 return $vars;
48 }
49
50 /**
51 * Adds a print stylesheet to the page's $head variable.
52 *
53 * This is a work-around for a serious bug in IE5 in which it loads print
54 * stylesheets for screen display when using an @import method, Drupal's default
55 * method when using drupal_add_css().
56 *
57 * @param string $url
58 * The URL of the print stylesheet
59 * @return
60 * All the rendered links for the $head variable
61 */
62 function igniter_add_print_css($url) {
63 global $base_path;
64 return drupal_set_html_head(
65 '<link'.
66 drupal_attributes(
67 array(
68 'rel' => 'stylesheet',
69 'href' => $base_path . $url,
70 'type' => 'text/css',
71 'media' => 'print',
72 )
73 ) ." />\n"
74 );
75 }

  ViewVC Help
Powered by ViewVC 1.1.2