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

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

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


Revision 1.1 - (show annotations) (download) (as text)
Tue Feb 12 04:32:52 2008 UTC (21 months, 2 weeks ago) by collectivecolors
Branch: MAIN
CVS Tags: DRUPAL-5--2-2, DRUPAL-5--2-3, DRUPAL-5--2-1, HEAD
Branch point for: DRUPAL-5--2
File MIME type: text/x-php
original bluefire theme
1 <?php
2
3 // $Id$
4
5 function bluefire_regions() {
6 return array(
7 'sidebar' => t('sidebar'),
8 'header' => t('header'),
9 'footer' => t('footer'),
10 'body' => t('body'),
11 );
12 }
13
14
15
16 function bluefire_links($links, $attributes = array('class' => 'links')) {
17 $output = '';
18
19 if (count($links) > 0) {
20 $output = '<ul'. drupal_attributes($attributes) .'>';
21
22 $num_links = count($links);
23 $i = 1;
24
25 foreach ($links as $key => $link) {
26 $class = '';
27
28 // Automatically add a class to each link and also to each LI
29 if (isset($link['attributes']) && isset($link['attributes']['class'])) {
30 $link['attributes']['class'] .= ' ' . $key;
31 $class = $key;
32 }
33 else {
34 $link['attributes']['class'] = $key;
35 $class = $key;
36 }
37
38
39 // Keep primary active when secondary is - Thanks to Sivarajan for this neat bit of code
40 $explode_array = explode('-',$link['attributes']['class']);
41 if(count($explode_array)== 5)
42 {
43 array_push($explode_array,'active');
44 $link['attributes']['class'] = implode('-',$explode_array);
45 $pos = strrpos($link['attributes']['class'], "-");
46 $link['attributes']['class'] = substr_replace($link['attributes']['class'], ' ', $pos, -6);
47 }
48
49
50 // Add first and last classes to the list of links to help out themers.
51 $extra_class = '';
52 if ($i == 1) {
53 $extra_class .= 'first ';
54 }
55 if ($i == $num_links) {
56 $extra_class .= 'last ';
57 }
58 $output .= '<li class="'. $extra_class . $class .'">';
59
60 // Is the title HTML?
61 $html = isset($link['html']) && $link['html'];
62
63 // Initialize fragment and query variables.
64 $link['query'] = isset($link['query']) ? $link['query'] : NULL;
65 $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
66
67 if (isset($link['href'])) {
68 $output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
69 }
70 else if ($link['title']) {
71 //Some links are actually not links, but we wrap these in <span> for adding title and class attributes
72 if (!$html) {
73 $link['title'] = check_plain($link['title']);
74 }
75 $output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
76 }
77
78 $i++;
79 $output .= "</li>"; /* KILL THE "\n" CHAR and save space! */
80 }
81
82 $output .= '</ul>';
83 }
84
85 return $output;
86 }
87
88
89 ?>

  ViewVC Help
Powered by ViewVC 1.1.2