Mercurial > hg > vamp-website
annotate 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 |
rev | line source |
---|---|
Chris@76 | 1 <?php |
Chris@76 | 2 /** |
Chris@76 | 3 * Simple Machines Forum (SMF) |
Chris@76 | 4 * |
Chris@76 | 5 * @package SMF |
Chris@76 | 6 * @author Simple Machines |
Chris@76 | 7 * @copyright 2011 Simple Machines |
Chris@76 | 8 * @license http://www.simplemachines.org/about/smf/license.php BSD |
Chris@76 | 9 * |
Chris@76 | 10 * @version 2.0 |
Chris@76 | 11 */ |
Chris@76 | 12 |
Chris@76 | 13 // Generate a strip of buttons, out of buttons. |
Chris@76 | 14 function template_button_strip($button_strip, $direction = 'top', $strip_options = array()) |
Chris@76 | 15 { |
Chris@76 | 16 global $settings, $context, $txt, $scripturl; |
Chris@76 | 17 |
Chris@76 | 18 // Compatibility. |
Chris@76 | 19 if (!is_array($strip_options)) |
Chris@76 | 20 $strip_options = array(); |
Chris@76 | 21 |
Chris@76 | 22 // Create the buttons... |
Chris@76 | 23 $buttons = array(); |
Chris@76 | 24 foreach ($button_strip as $key => $value) |
Chris@76 | 25 { |
Chris@76 | 26 if (!isset($value['test']) || !empty($context[$value['test']])) |
Chris@76 | 27 $buttons[] = ' |
Chris@76 | 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>'; |
Chris@76 | 29 } |
Chris@76 | 30 |
Chris@76 | 31 // No buttons? No button strip either. |
Chris@76 | 32 if (empty($buttons)) |
Chris@76 | 33 return; |
Chris@76 | 34 |
Chris@76 | 35 // Make the last one, as easy as possible. |
Chris@76 | 36 $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]); |
Chris@76 | 37 |
Chris@76 | 38 echo ' |
Chris@76 | 39 <div class="buttonlist', $direction != 'top' ? '_bottom' : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '> |
Chris@76 | 40 <ul class="reset clearfix"> |
Chris@76 | 41 ', implode('', $buttons), ' |
Chris@76 | 42 </ul> |
Chris@76 | 43 </div>'; |
Chris@76 | 44 } |
Chris@76 | 45 |
Chris@76 | 46 ?> |