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

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

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


Revision 1.1 - (show annotations) (download) (as text)
Fri Feb 22 03:15:47 2008 UTC (21 months ago) by roopletheme
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
File MIME type: text/x-php
Initial Release for Drupal 5.0
1 <?php
2 // $Id: template.php 11 2008-02-21 13:24:51Z bill $
3 // www.roopletheme.com
4
5 if (is_null(theme_get_setting('tapestry_style'))) {
6 global $theme_key;
7
8 // Save default theme settings
9 $defaults = array(
10 'tapestry_style' => 'gerberdaisy',
11 'tapestry_usefixedwidth' => 1,
12 'tapestry_suckerfishmenus' => 0,
13 'tapestry_suckerfishalign' => 'right',
14 'tapestry_fixedwidth' => '850',
15 'tapestry_fontfamily' => 0,
16 'tapestry_customfont' => '',
17 'tapestry_uselocalcontent' => '0',
18 'tapestry_localcontentfile' => '',
19 'tapestry_breadcrumb' => 0,
20 'tapestry_themelogo' => 0,
21 'tapestry_useicons' => 0,
22 'tapestry_ie6icons' => 1,
23 'tapestry_leftsidebarwidth' => '210',
24 'tapestry_rightsidebarwidth' => '210',
25 'tapestry_sidebarmode' => 'center',
26 'tapestry_outsidebar' => 'left',
27 'tapestry_outsidebarwidth' => '180',
28 'tapestry_iepngfix' => 0,
29 );
30
31 variable_set(
32 str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
33 array_merge(theme_get_settings($theme_key), $defaults)
34 );
35 // Force refresh of Drupal internals
36 theme_get_setting('', TRUE);
37 }
38
39 function tapestry_regions() {
40 return array(
41 'leaderboard' => t('leaderboard'),
42 'suckerfish' => t('suckerfish menu'),
43 'sidebar_left' => t('left sidebar'),
44 'sidebar_right' => t('right sidebar'),
45 'sidebar_outside' => t('outside sidebar'),
46 'content_top_left' => t('content top left'),
47 'content_top_right' => t('content top right'),
48 'content_bottom_left' => t('content bottom left'),
49 'content_bottom_right' => t('content bottom right'),
50 'header_left' => t('header left'),
51 'header_center' => t('header center'),
52 'header_right' => t('header right'),
53 'banner' => t('banner'),
54 'user1' => t('user1'),
55 'user2' => t('user2'),
56 'user3' => t('user3'),
57 'user4' => t('user4'),
58 'user5' => t('user5'),
59 'user6' => t('user6'),
60 'user7' => t('user7'),
61 'user8' => t('user8'),
62 'user9' => t('user9'),
63 'user10' => t('user10'),
64 'user11' => t('user11'),
65 'user12' => t('user12'),
66 'user13' => t('user13'),
67 'user14' => t('user14'),
68 'user15' => t('user15'),
69 'footer_left' => t('footer left'),
70 'footer_center' => t('footer center'),
71 'footer_right' => t('footer right')
72 );
73 }
74
75
76 function get_tapestry_style() {
77 $style = theme_get_setting('tapestry_style');
78 if (!$style)
79 {
80 $style = 'gerberdaisy';
81 }
82 if (isset($_COOKIE["tapestrystyle"])) {
83 $style = $_COOKIE["tapestrystyle"];
84 }
85 return $style;
86 }
87
88 drupal_add_css(drupal_get_path('theme', 'tapestry') . '/css/' . get_tapestry_style() . '.css', 'theme');
89
90 drupal_add_css(drupal_get_path('theme', 'tapestry') . '/css/suckerfish.css', 'theme');
91
92 if (theme_get_setting('tapestry_iepngfix')) {
93 drupal_add_js(drupal_get_path('theme', 'tapestry') . '/js/jquery.pngFix.js', 'theme');
94 }
95
96 if (theme_get_setting('tapestry_themelogo')) {
97 function _phptemplate_variables($hook, $variables = array()) {
98 $styled_logo = '/images/' . get_tapestry_style() . '/logo.png';
99 $variables['logo'] = base_path() . drupal_get_path('theme', 'tapestry') . $styled_logo;
100 return $variables;
101 }
102 }
103
104 if (theme_get_setting('tapestry_uselocalcontent')) {
105 $local_content = drupal_get_path('theme', 'tapestry') . '/' . theme_get_setting('tapestry_localcontentfile');
106 if (file_exists($local_content)) {
107 drupal_add_css($local_content, 'theme');
108 }
109 }
110
111 function tapestry_breadcrumb($breadcrumb) {
112 if (!empty($breadcrumb)) {
113 $styled_breadcrumb = '/images/' . get_tapestry_style() . '/bullet-breadcrumb.png';
114 $output = '<div class="breadcrumb">';
115 $count = count($breadcrumb);
116 $i = 1;
117 foreach ($breadcrumb as $crumb) {
118 $output .= $crumb;
119 $i++;
120 if ($i <= $count) {
121 $bullet = base_path() . path_to_theme() . $styled_breadcrumb;
122 $output .= ' <image src="' . $bullet . '" /> ';
123 }
124 }
125 $output .= '</div>';
126 return $output;
127 }
128 }
129
130 function tapestry_block($block) {
131 if (module_exists('blocktheme')) {
132 if ( $custom_theme = blocktheme_get_theme($block) ) {
133 return _phptemplate_callback($custom_theme,array('block' => $block));
134 }
135 }
136 return phptemplate_block($block);
137 }
138
139 function phptemplate_menu_links($links) {
140 if (!count($links)) {
141 return '';
142 }
143 $level_tmp = explode('-', key($links));
144 $level = $level_tmp[0];
145 $output = "<ul class=\"links-$level\">\n";
146 foreach ($links as $index => $link) {
147 $output .= '<li';
148 $css_id = 'item-' . strtolower(str_replace(' ', '_', strip_tags($link['title'])));
149 $output .= ' class="' . $css_id . '"';
150 if (stristr($index, 'active')) {
151 $output .= ' class="active"';
152 }
153 $output .= ">". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."</li>\n";
154 }
155 $output .= '</ul>';
156
157 return $output;
158 }

  ViewVC Help
Powered by ViewVC 1.1.2