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

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

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


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

  ViewVC Help
Powered by ViewVC 1.1.2