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 /* This template is, perhaps, the most important template in the theme. It
|
Chris@76
|
14 contains the main template layer that displays the header and footer of
|
Chris@76
|
15 the forum, namely with main_above and main_below. It also contains the
|
Chris@76
|
16 menu sub template, which appropriately displays the menu; the init sub
|
Chris@76
|
17 template, which is there to set the theme up; (init can be missing.) and
|
Chris@76
|
18 the linktree sub template, which sorts out the link tree.
|
Chris@76
|
19
|
Chris@76
|
20 The init sub template should load any data and set any hardcoded options.
|
Chris@76
|
21
|
Chris@76
|
22 The main_above sub template is what is shown above the main content, and
|
Chris@76
|
23 should contain anything that should be shown up there.
|
Chris@76
|
24
|
Chris@76
|
25 The main_below sub template, conversely, is shown after the main content.
|
Chris@76
|
26 It should probably contain the copyright statement and some other things.
|
Chris@76
|
27
|
Chris@76
|
28 The linktree sub template should display the link tree, using the data
|
Chris@76
|
29 in the $context['linktree'] variable.
|
Chris@76
|
30
|
Chris@76
|
31 The menu sub template should display all the relevant buttons the user
|
Chris@76
|
32 wants and or needs.
|
Chris@76
|
33
|
Chris@76
|
34 For more information on the templating system, please see the site at:
|
Chris@76
|
35 http://www.simplemachines.org/
|
Chris@76
|
36 */
|
Chris@76
|
37
|
Chris@76
|
38 // Initialize the template... mainly little settings.
|
Chris@76
|
39 function template_init()
|
Chris@76
|
40 {
|
Chris@76
|
41 global $context, $settings, $options, $txt;
|
Chris@76
|
42
|
Chris@76
|
43 /* Use images from default theme when using templates from the default theme?
|
Chris@76
|
44 if this is 'always', images from the default theme will be used.
|
Chris@76
|
45 if this is 'defaults', images from the default theme will only be used with default templates.
|
Chris@76
|
46 if this is 'never' or isn't set at all, images from the default theme will not be used. */
|
Chris@76
|
47 $settings['use_default_images'] = 'never';
|
Chris@76
|
48
|
Chris@76
|
49 /* What document type definition is being used? (for font size and other issues.)
|
Chris@76
|
50 'xhtml' for an XHTML 1.0 document type definition.
|
Chris@76
|
51 'html' for an HTML 4.01 document type definition. */
|
Chris@76
|
52 $settings['doctype'] = 'xhtml';
|
Chris@76
|
53
|
Chris@76
|
54 /* The version this template/theme is for.
|
Chris@76
|
55 This should probably be the version of SMF it was created for. */
|
Chris@76
|
56 $settings['theme_version'] = '2.0';
|
Chris@76
|
57
|
Chris@76
|
58 /* Set a setting that tells the theme that it can render the tabs. */
|
Chris@76
|
59 $settings['use_tabs'] = true;
|
Chris@76
|
60
|
Chris@76
|
61 /* Use plain buttons - as opposed to text buttons? */
|
Chris@76
|
62 $settings['use_buttons'] = true;
|
Chris@76
|
63
|
Chris@76
|
64 /* Show sticky and lock status separate from topic icons? */
|
Chris@76
|
65 $settings['separate_sticky_lock'] = true;
|
Chris@76
|
66
|
Chris@76
|
67 /* Does this theme use the strict doctype? */
|
Chris@76
|
68 $settings['strict_doctype'] = false;
|
Chris@76
|
69
|
Chris@76
|
70 /* Does this theme use post previews on the message index? */
|
Chris@76
|
71 $settings['message_index_preview'] = false;
|
Chris@76
|
72
|
Chris@76
|
73 /* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
|
Chris@76
|
74 $settings['require_theme_strings'] = false;
|
Chris@76
|
75 }
|
Chris@76
|
76
|
Chris@76
|
77 // The main sub template above the content.
|
Chris@76
|
78 function template_html_above()
|
Chris@76
|
79 {
|
Chris@76
|
80 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
81
|
Chris@76
|
82 // Show right to left and the character set for ease of translating.
|
Chris@76
|
83 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
Chris@76
|
84 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
|
Chris@76
|
85 <head>';
|
Chris@76
|
86
|
Chris@76
|
87 // The ?fin20 part of this link is just here to make sure browsers don't cache it wrongly.
|
Chris@76
|
88 echo '
|
Chris@76
|
89 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />';
|
Chris@76
|
90
|
Chris@76
|
91 // Some browsers need an extra stylesheet due to bugs/compatibility issues.
|
Chris@76
|
92 foreach (array('ie7', 'ie6', 'webkit') as $cssfix)
|
Chris@76
|
93 if ($context['browser']['is_' . $cssfix])
|
Chris@76
|
94 echo '
|
Chris@76
|
95 <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/css/', $cssfix, '.css" />';
|
Chris@76
|
96
|
Chris@76
|
97 // RTL languages require an additional stylesheet.
|
Chris@76
|
98 if ($context['right_to_left'])
|
Chris@76
|
99 echo '
|
Chris@76
|
100 <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/rtl.css" />';
|
Chris@76
|
101
|
Chris@76
|
102 // Here comes the JavaScript bits!
|
Chris@76
|
103 echo '
|
Chris@76
|
104 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
|
Chris@76
|
105 <script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
|
Chris@76
|
106 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
107 var smf_theme_url = "', $settings['theme_url'], '";
|
Chris@76
|
108 var smf_default_theme_url = "', $settings['default_theme_url'], '";
|
Chris@76
|
109 var smf_images_url = "', $settings['images_url'], '";
|
Chris@76
|
110 var smf_scripturl = "', $scripturl, '";
|
Chris@76
|
111 var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
|
Chris@76
|
112 var smf_charset = "', $context['character_set'], '";', $context['show_pm_popup'] ? '
|
Chris@76
|
113 var fPmPopup = function ()
|
Chris@76
|
114 {
|
Chris@76
|
115 if (confirm("' . $txt['show_personal_messages'] . '"))
|
Chris@76
|
116 window.open(smf_prepareScriptUrl(smf_scripturl) + "action=pm");
|
Chris@76
|
117 }
|
Chris@76
|
118 addLoadEvent(fPmPopup);' : '', '
|
Chris@76
|
119 var ajax_notification_text = "', $txt['ajax_in_progress'], '";
|
Chris@76
|
120 var ajax_notification_cancel_text = "', $txt['modify_cancel'], '";
|
Chris@76
|
121 // ]]></script>';
|
Chris@76
|
122
|
Chris@76
|
123 echo '
|
Chris@76
|
124 <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
|
Chris@76
|
125 <meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? '
|
Chris@76
|
126 <meta name="keywords" content="' . $context['meta_keywords'] . '" />' : '', '
|
Chris@76
|
127 <title>', $context['page_title_html_safe'], '</title>';
|
Chris@76
|
128
|
Chris@76
|
129 // Please don't index these Mr Robot.
|
Chris@76
|
130 if (!empty($context['robot_no_index']))
|
Chris@76
|
131 echo '
|
Chris@76
|
132 <meta name="robots" content="noindex" />';
|
Chris@76
|
133
|
Chris@76
|
134 // Present a canonical url for search engines to prevent duplicate content in their indices.
|
Chris@76
|
135 if (!empty($context['canonical_url']))
|
Chris@76
|
136 echo '
|
Chris@76
|
137 <link rel="canonical" href="', $context['canonical_url'], '" />';
|
Chris@76
|
138
|
Chris@76
|
139 // Show all the relative links, such as help, search, contents, and the like.
|
Chris@76
|
140 echo '
|
Chris@76
|
141 <link rel="help" href="', $scripturl, '?action=help" />
|
Chris@76
|
142 <link rel="search" href="', $scripturl, '?action=search" />
|
Chris@76
|
143 <link rel="contents" href="', $scripturl, '" />';
|
Chris@76
|
144
|
Chris@76
|
145 // If RSS feeds are enabled, advertise the presence of one.
|
Chris@76
|
146 if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
|
Chris@76
|
147 echo '
|
Chris@76
|
148 <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss;action=.xml" />';
|
Chris@76
|
149
|
Chris@76
|
150 // If we're viewing a topic, these should be the previous and next topics, respectively.
|
Chris@76
|
151 if (!empty($context['current_topic']))
|
Chris@76
|
152 echo '
|
Chris@76
|
153 <link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />
|
Chris@76
|
154 <link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';
|
Chris@76
|
155
|
Chris@76
|
156 // If we're in a board, or a topic for that matter, the index will be the board's index.
|
Chris@76
|
157 if (!empty($context['current_board']))
|
Chris@76
|
158 echo '
|
Chris@76
|
159 <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />';
|
Chris@76
|
160
|
Chris@76
|
161 // Output any remaining HTML headers. (from mods, maybe?)
|
Chris@76
|
162 echo $context['html_headers'];
|
Chris@76
|
163
|
Chris@76
|
164 echo '
|
Chris@76
|
165 </head>
|
Chris@76
|
166 <body>';
|
Chris@76
|
167 }
|
Chris@76
|
168
|
Chris@76
|
169 function template_body_above()
|
Chris@76
|
170 {
|
Chris@76
|
171 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
172
|
Chris@76
|
173 echo !empty($settings['forum_width']) ? '
|
Chris@76
|
174 <div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
|
Chris@76
|
175 <div id="header"><div class="frame">
|
Chris@76
|
176 <div id="top_section">
|
Chris@76
|
177 <h1 class="forumtitle">
|
Chris@76
|
178 <a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
|
Chris@76
|
179 </h1>';
|
Chris@76
|
180
|
Chris@76
|
181 // the upshrink image, right-floated
|
Chris@76
|
182 echo '
|
Chris@76
|
183 <img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';
|
Chris@76
|
184 echo '
|
Chris@76
|
185 ', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />' : '<div id="siteslogan" class="floatright">' . $settings['site_slogan'] . '</div>', '
|
Chris@76
|
186 </div>
|
Chris@76
|
187 <div id="upper_section" class="middletext"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
|
Chris@76
|
188 <div class="user">';
|
Chris@76
|
189
|
Chris@76
|
190 // If the user is logged in, display stuff like their name, new messages, etc.
|
Chris@76
|
191 if ($context['user']['is_logged'])
|
Chris@76
|
192 {
|
Chris@76
|
193 if (!empty($context['user']['avatar']))
|
Chris@76
|
194 echo '
|
Chris@76
|
195 <p class="avatar">', $context['user']['avatar']['image'], '</p>';
|
Chris@76
|
196 echo '
|
Chris@76
|
197 <ul class="reset">
|
Chris@76
|
198 <li class="greeting">', $txt['hello_member_ndt'], ' <span>', $context['user']['name'], '</span></li>
|
Chris@76
|
199 <li><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a></li>
|
Chris@76
|
200 <li><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></li>';
|
Chris@76
|
201
|
Chris@76
|
202 // Is the forum in maintenance mode?
|
Chris@76
|
203 if ($context['in_maintenance'] && $context['user']['is_admin'])
|
Chris@76
|
204 echo '
|
Chris@76
|
205 <li class="notice">', $txt['maintain_mode_on'], '</li>';
|
Chris@76
|
206
|
Chris@76
|
207 // Are there any members waiting for approval?
|
Chris@76
|
208 if (!empty($context['unapproved_members']))
|
Chris@76
|
209 echo '
|
Chris@76
|
210 <li>', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '</li>';
|
Chris@76
|
211
|
Chris@76
|
212 if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
|
Chris@76
|
213 echo '
|
Chris@76
|
214 <li><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';
|
Chris@76
|
215
|
Chris@76
|
216 echo '
|
Chris@76
|
217 <li>', $context['current_time'], '</li>
|
Chris@76
|
218 </ul>';
|
Chris@76
|
219 }
|
Chris@76
|
220 // Otherwise they're a guest - this time ask them to either register or login - lazy bums...
|
Chris@76
|
221 elseif (!empty($context['show_login_bar']))
|
Chris@76
|
222 {
|
Chris@76
|
223 echo '
|
Chris@76
|
224 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
|
Chris@76
|
225 <form id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
|
Chris@76
|
226 <div class="info">', sprintf($txt['welcome_guest'], $txt['guest_title']), '</div>
|
Chris@76
|
227 <input type="text" name="user" size="10" class="input_text" />
|
Chris@76
|
228 <input type="password" name="passwrd" size="10" class="input_password" />
|
Chris@76
|
229 <select name="cookielength">
|
Chris@76
|
230 <option value="60">', $txt['one_hour'], '</option>
|
Chris@76
|
231 <option value="1440">', $txt['one_day'], '</option>
|
Chris@76
|
232 <option value="10080">', $txt['one_week'], '</option>
|
Chris@76
|
233 <option value="43200">', $txt['one_month'], '</option>
|
Chris@76
|
234 <option value="-1" selected="selected">', $txt['forever'], '</option>
|
Chris@76
|
235 </select>
|
Chris@76
|
236 <input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
|
Chris@76
|
237 <div class="info">', $txt['quick_login_dec'], '</div>';
|
Chris@76
|
238
|
Chris@76
|
239 if (!empty($modSettings['enableOpenID']))
|
Chris@76
|
240 echo '
|
Chris@76
|
241 <br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';
|
Chris@76
|
242
|
Chris@76
|
243 echo '
|
Chris@76
|
244 <input type="hidden" name="hash_passwrd" value="" />
|
Chris@76
|
245 </form>';
|
Chris@76
|
246 }
|
Chris@76
|
247
|
Chris@76
|
248 echo '
|
Chris@76
|
249 </div>
|
Chris@76
|
250 <div class="news normaltext">
|
Chris@76
|
251 <form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
|
Chris@76
|
252 <input type="text" name="search" value="" class="input_text" />
|
Chris@76
|
253 <input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
|
Chris@76
|
254 <input type="hidden" name="advanced" value="0" />';
|
Chris@76
|
255
|
Chris@76
|
256 // Search within current topic?
|
Chris@76
|
257 if (!empty($context['current_topic']))
|
Chris@76
|
258 echo '
|
Chris@76
|
259 <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
|
Chris@76
|
260 // If we're on a certain board, limit it to this board ;).
|
Chris@76
|
261 elseif (!empty($context['current_board']))
|
Chris@76
|
262 echo '
|
Chris@76
|
263 <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
|
Chris@76
|
264
|
Chris@76
|
265 echo '</form>';
|
Chris@76
|
266
|
Chris@76
|
267 // Show a random news item? (or you could pick one from news_lines...)
|
Chris@76
|
268 if (!empty($settings['enable_news']))
|
Chris@76
|
269 echo '
|
Chris@76
|
270 <h2>', $txt['news'], ': </h2>
|
Chris@76
|
271 <p>', $context['random_news_line'], '</p>';
|
Chris@76
|
272
|
Chris@76
|
273 echo '
|
Chris@76
|
274 </div>
|
Chris@76
|
275 </div>
|
Chris@76
|
276 <br class="clear" />';
|
Chris@76
|
277
|
Chris@76
|
278 // Define the upper_section toggle in JavaScript.
|
Chris@76
|
279 echo '
|
Chris@76
|
280 <script type="text/javascript"><!-- // --><![CDATA[
|
Chris@76
|
281 var oMainHeaderToggle = new smc_Toggle({
|
Chris@76
|
282 bToggleEnabled: true,
|
Chris@76
|
283 bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
|
Chris@76
|
284 aSwappableContainers: [
|
Chris@76
|
285 \'upper_section\'
|
Chris@76
|
286 ],
|
Chris@76
|
287 aSwapImages: [
|
Chris@76
|
288 {
|
Chris@76
|
289 sId: \'upshrink\',
|
Chris@76
|
290 srcExpanded: smf_images_url + \'/upshrink.png\',
|
Chris@76
|
291 altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
|
Chris@76
|
292 srcCollapsed: smf_images_url + \'/upshrink2.png\',
|
Chris@76
|
293 altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
|
Chris@76
|
294 }
|
Chris@76
|
295 ],
|
Chris@76
|
296 oThemeOptions: {
|
Chris@76
|
297 bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
|
Chris@76
|
298 sOptionName: \'collapse_header\',
|
Chris@76
|
299 sSessionVar: ', JavaScriptEscape($context['session_var']), ',
|
Chris@76
|
300 sSessionId: ', JavaScriptEscape($context['session_id']), '
|
Chris@76
|
301 },
|
Chris@76
|
302 oCookieOptions: {
|
Chris@76
|
303 bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
|
Chris@76
|
304 sCookieName: \'upshrink\'
|
Chris@76
|
305 }
|
Chris@76
|
306 });
|
Chris@76
|
307 // ]]></script>';
|
Chris@76
|
308
|
Chris@76
|
309 // Show the menu here, according to the menu sub template.
|
Chris@76
|
310 template_menu();
|
Chris@76
|
311
|
Chris@76
|
312 echo '
|
Chris@76
|
313 <br class="clear" />
|
Chris@76
|
314 </div></div>';
|
Chris@76
|
315
|
Chris@76
|
316 // The main content should go here.
|
Chris@76
|
317 echo '
|
Chris@76
|
318 <div id="content_section"><div class="frame">
|
Chris@76
|
319 <div id="main_content_section">';
|
Chris@76
|
320
|
Chris@76
|
321 // Custom banners and shoutboxes should be placed here, before the linktree.
|
Chris@76
|
322
|
Chris@76
|
323 // Show the navigation tree.
|
Chris@76
|
324 theme_linktree();
|
Chris@76
|
325 }
|
Chris@76
|
326
|
Chris@76
|
327 function template_body_below()
|
Chris@76
|
328 {
|
Chris@76
|
329 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
330
|
Chris@76
|
331 echo '
|
Chris@76
|
332 </div>
|
Chris@76
|
333 </div></div>';
|
Chris@76
|
334
|
Chris@76
|
335 // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
|
Chris@76
|
336 echo '
|
Chris@76
|
337 <div id="footer_section"><div class="frame">
|
Chris@76
|
338 <ul class="reset">
|
Chris@76
|
339 <li class="copyright">', theme_copyright(), '</li>
|
Chris@76
|
340 <li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>
|
Chris@76
|
341 ', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '
|
Chris@76
|
342 <li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>
|
Chris@76
|
343 </ul>';
|
Chris@76
|
344
|
Chris@76
|
345 // Show the load time?
|
Chris@76
|
346 if ($context['show_load_time'])
|
Chris@76
|
347 echo '
|
Chris@76
|
348 <p>', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';
|
Chris@76
|
349
|
Chris@76
|
350 echo '
|
Chris@76
|
351 </div></div>', !empty($settings['forum_width']) ? '
|
Chris@76
|
352 </div>' : '';
|
Chris@76
|
353 }
|
Chris@76
|
354
|
Chris@76
|
355 function template_html_below()
|
Chris@76
|
356 {
|
Chris@76
|
357 global $context, $settings, $options, $scripturl, $txt, $modSettings;
|
Chris@76
|
358
|
Chris@76
|
359 echo '
|
Chris@76
|
360 </body></html>';
|
Chris@76
|
361 }
|
Chris@76
|
362
|
Chris@76
|
363 // Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
|
Chris@76
|
364 function theme_linktree($force_show = false)
|
Chris@76
|
365 {
|
Chris@76
|
366 global $context, $settings, $options, $shown_linktree;
|
Chris@76
|
367
|
Chris@76
|
368 // If linktree is empty, just return - also allow an override.
|
Chris@76
|
369 if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
|
Chris@76
|
370 return;
|
Chris@76
|
371
|
Chris@76
|
372 echo '
|
Chris@76
|
373 <div class="navigate_section">
|
Chris@76
|
374 <ul>';
|
Chris@76
|
375
|
Chris@76
|
376 // Each tree item has a URL and name. Some may have extra_before and extra_after.
|
Chris@76
|
377 foreach ($context['linktree'] as $link_num => $tree)
|
Chris@76
|
378 {
|
Chris@76
|
379 echo '
|
Chris@76
|
380 <li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', '>';
|
Chris@76
|
381
|
Chris@76
|
382 // Show something before the link?
|
Chris@76
|
383 if (isset($tree['extra_before']))
|
Chris@76
|
384 echo $tree['extra_before'];
|
Chris@76
|
385
|
Chris@76
|
386 // Show the link, including a URL if it should have one.
|
Chris@76
|
387 echo $settings['linktree_link'] && isset($tree['url']) ? '
|
Chris@76
|
388 <a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>' : '<span>' . $tree['name'] . '</span>';
|
Chris@76
|
389
|
Chris@76
|
390 // Show something after the link...?
|
Chris@76
|
391 if (isset($tree['extra_after']))
|
Chris@76
|
392 echo $tree['extra_after'];
|
Chris@76
|
393
|
Chris@76
|
394 // Don't show a separator for the last one.
|
Chris@76
|
395 if ($link_num != count($context['linktree']) - 1)
|
Chris@76
|
396 echo ' »';
|
Chris@76
|
397
|
Chris@76
|
398 echo '
|
Chris@76
|
399 </li>';
|
Chris@76
|
400 }
|
Chris@76
|
401 echo '
|
Chris@76
|
402 </ul>
|
Chris@76
|
403 </div>';
|
Chris@76
|
404
|
Chris@76
|
405 $shown_linktree = true;
|
Chris@76
|
406 }
|
Chris@76
|
407
|
Chris@76
|
408 // Show the menu up top. Something like [home] [help] [profile] [logout]...
|
Chris@76
|
409 function template_menu()
|
Chris@76
|
410 {
|
Chris@76
|
411 global $context, $settings, $options, $scripturl, $txt;
|
Chris@76
|
412
|
Chris@76
|
413 echo '
|
Chris@76
|
414 <div id="main_menu">
|
Chris@76
|
415 <ul class="dropmenu" id="menu_nav">';
|
Chris@76
|
416
|
Chris@76
|
417 foreach ($context['menu_buttons'] as $act => $button)
|
Chris@76
|
418 {
|
Chris@76
|
419 echo '
|
Chris@76
|
420 <li id="button_', $act, '">
|
Chris@76
|
421 <a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
|
Chris@76
|
422 <span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
|
Chris@76
|
423 </a>';
|
Chris@76
|
424 if (!empty($button['sub_buttons']))
|
Chris@76
|
425 {
|
Chris@76
|
426 echo '
|
Chris@76
|
427 <ul>';
|
Chris@76
|
428
|
Chris@76
|
429 foreach ($button['sub_buttons'] as $childbutton)
|
Chris@76
|
430 {
|
Chris@76
|
431 echo '
|
Chris@76
|
432 <li>
|
Chris@76
|
433 <a href="', $childbutton['href'], '"', isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '>
|
Chris@76
|
434 <span', isset($childbutton['is_last']) ? ' class="last"' : '', '>', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '</span>
|
Chris@76
|
435 </a>';
|
Chris@76
|
436 // 3rd level menus :)
|
Chris@76
|
437 if (!empty($childbutton['sub_buttons']))
|
Chris@76
|
438 {
|
Chris@76
|
439 echo '
|
Chris@76
|
440 <ul>';
|
Chris@76
|
441
|
Chris@76
|
442 foreach ($childbutton['sub_buttons'] as $grandchildbutton)
|
Chris@76
|
443 echo '
|
Chris@76
|
444 <li>
|
Chris@76
|
445 <a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
|
Chris@76
|
446 <span', isset($grandchildbutton['is_last']) ? ' class="last"' : '', '>', $grandchildbutton['title'], '</span>
|
Chris@76
|
447 </a>
|
Chris@76
|
448 </li>';
|
Chris@76
|
449
|
Chris@76
|
450 echo '
|
Chris@76
|
451 </ul>';
|
Chris@76
|
452 }
|
Chris@76
|
453
|
Chris@76
|
454 echo '
|
Chris@76
|
455 </li>';
|
Chris@76
|
456 }
|
Chris@76
|
457 echo '
|
Chris@76
|
458 </ul>';
|
Chris@76
|
459 }
|
Chris@76
|
460 echo '
|
Chris@76
|
461 </li>';
|
Chris@76
|
462 }
|
Chris@76
|
463
|
Chris@76
|
464 echo '
|
Chris@76
|
465 </ul>
|
Chris@76
|
466 </div>';
|
Chris@76
|
467 }
|
Chris@76
|
468
|
Chris@76
|
469 // Generate a strip of buttons.
|
Chris@76
|
470 function template_button_strip($button_strip, $direction = 'top', $strip_options = array())
|
Chris@76
|
471 {
|
Chris@76
|
472 global $settings, $context, $txt, $scripturl;
|
Chris@76
|
473
|
Chris@76
|
474 if (!is_array($strip_options))
|
Chris@76
|
475 $strip_options = array();
|
Chris@76
|
476
|
Chris@76
|
477 // List the buttons in reverse order for RTL languages.
|
Chris@76
|
478 if ($context['right_to_left'])
|
Chris@76
|
479 $button_strip = array_reverse($button_strip, true);
|
Chris@76
|
480
|
Chris@76
|
481 // Create the buttons...
|
Chris@76
|
482 $buttons = array();
|
Chris@76
|
483 foreach ($button_strip as $key => $value)
|
Chris@76
|
484 {
|
Chris@76
|
485 if (!isset($value['test']) || !empty($context[$value['test']]))
|
Chris@76
|
486 $buttons[] = '
|
Chris@76
|
487 <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
|
488 }
|
Chris@76
|
489
|
Chris@76
|
490 // No buttons? No button strip either.
|
Chris@76
|
491 if (empty($buttons))
|
Chris@76
|
492 return;
|
Chris@76
|
493
|
Chris@76
|
494 // Make the last one, as easy as possible.
|
Chris@76
|
495 $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);
|
Chris@76
|
496
|
Chris@76
|
497 echo '
|
Chris@76
|
498 <div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
|
Chris@76
|
499 <ul>',
|
Chris@76
|
500 implode('', $buttons), '
|
Chris@76
|
501 </ul>
|
Chris@76
|
502 </div>';
|
Chris@76
|
503 }
|
Chris@76
|
504
|
Chris@76
|
505 ?> |