Mercurial > hg > vamp-website
comparison forum/Themes/default/Compat.template.php @ 76:e3e11437ecea website
Add forum code
author | Chris Cannam |
---|---|
date | Sun, 07 Jul 2013 11:25:48 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
75:72f59aa7e503 | 76:e3e11437ecea |
---|---|
1 <?php | |
2 /** | |
3 * Simple Machines Forum (SMF) | |
4 * | |
5 * @package SMF | |
6 * @author Simple Machines | |
7 * @copyright 2011 Simple Machines | |
8 * @license http://www.simplemachines.org/about/smf/license.php BSD | |
9 * | |
10 * @version 2.0 | |
11 */ | |
12 | |
13 // Generate a strip of buttons, out of buttons. | |
14 function template_button_strip($button_strip, $direction = 'top', $strip_options = array()) | |
15 { | |
16 global $settings, $context, $txt, $scripturl; | |
17 | |
18 // Compatibility. | |
19 if (!is_array($strip_options)) | |
20 $strip_options = array(); | |
21 | |
22 // Create the buttons... | |
23 $buttons = array(); | |
24 foreach ($button_strip as $key => $value) | |
25 { | |
26 if (!isset($value['test']) || !empty($context[$value['test']])) | |
27 $buttons[] = ' | |
28 <li><a' . (isset($value['id']) ? ' id="button_strip_' . $value['id'] . '"' : '') . ' class="button_strip_' . $key . (isset($value['active']) ? ' active' : '') . '" href="' . $value['url'] . '"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '><span>' . $txt[$value['text']] . '</span></a></li>'; | |
29 } | |
30 | |
31 // No buttons? No button strip either. | |
32 if (empty($buttons)) | |
33 return; | |
34 | |
35 // Make the last one, as easy as possible. | |
36 $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]); | |
37 | |
38 echo ' | |
39 <div class="buttonlist', $direction != 'top' ? '_bottom' : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '> | |
40 <ul class="reset clearfix"> | |
41 ', implode('', $buttons), ' | |
42 </ul> | |
43 </div>'; | |
44 } | |
45 | |
46 ?> |