'' . $txt['pages'] . '',
'previous_page' => '',
'current_page' => '%1$d ',
'page' => '%2$s ',
'expand_pages' => ' ... ',
'next_page' => '',
'extra_after' => '',
);
// Allow css/js files to be disabled for this specific theme.
// Add the identifier as an array key. IE array('smf_script'); Some external files might not add identifiers, on those cases SMF uses its filename as reference.
if (!isset($settings['disable_files']))
$settings['disable_files'] = array();
}
/**
* The main sub template above the content.
*/
function template_html_above()
{
global $context, $scripturl, $txt, $modSettings;
// Show right to left, the language code, and the character set for ease of translating.
echo '
';
/*
You don't need to manually load index.css, this will be set up for you.
Note that RTL will also be loaded for you.
To load other CSS and JS files you should use the functions
loadCSSFile() and loadJavaScriptFile() respectively.
This approach will let you take advantage of SMF's automatic CSS
minimization and other benefits. You can, of course, manually add any
other files you want after template_css() has been run.
* Short example:
- CSS: loadCSSFile('filename.css', array('minimize' => true));
- JS: loadJavaScriptFile('filename.js', array('minimize' => true));
You can also read more detailed usages of the parameters for these
functions on the SMF wiki.
* Themes:
The most efficient way of writing multi themes is to use a master
index.css plus variant.css files. If you've set them up properly
(through $settings['theme_variants']), the variant files will be loaded
for you automatically.
Additionally, tweaking the CSS for the editor requires you to include
a custom 'jquery.sceditor.theme.css' file in the css folder if you need it.
* MODs:
If you want to load CSS or JS files in here, the best way is to use the
'integrate_load_theme' hook for adding multiple files, or using
'integrate_pre_css_output', 'integrate_pre_javascript_output' for a single file.
*/
// load in any css from mods or themes so they can overwrite if wanted
template_css();
// load in any javascript files from mods and themes
template_javascript();
echo '
', $context['page_title_html_safe'], '
';
// Content related meta tags, like description, keywords, Open Graph stuff, etc...
foreach ($context['meta_tags'] as $meta_tag)
{
echo '
$meta_value)
echo ' ', $meta_key, '="', $meta_value, '"';
echo '>';
}
/* What is your Lollipop's color?
Theme Authors, you can change the color here to make sure your theme's main color gets visible on tab */
echo '
';
// Please don't index these Mr Robot.
if (!empty($context['robot_no_index']))
echo '
';
// Present a canonical url for search engines to prevent duplicate content in their indices.
if (!empty($context['canonical_url']))
echo '
';
// Show all the relative links, such as help, search, contents, and the like.
echo '
', ($context['allow_search'] ? '
' : '');
// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
echo '
';
// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['links']['next']))
echo '
';
if (!empty($context['links']['prev']))
echo '
';
// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
';
// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];
echo '
';
// Show the footer with copyright, terms and help links.
echo '
';
}
/**
* This shows any deferred JavaScript and closes out the HTML
*/
function template_html_below()
{
// Load in any javascipt that could be deferred to the end of the page
template_javascript(true);
echo '
';
}
/**
* Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
*
* @param bool $force_show Whether to force showing it even if settings say otherwise
*/
function theme_linktree($force_show = false)
{
global $context, $shown_linktree, $scripturl, $txt;
// If linktree is empty, just return - also allow an override.
if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
return;
echo '
';
// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
echo '
';
// Don't show a separator for the first one.
// Better here. Always points to the next level when the linktree breaks to a second line.
// Picked a better looking HTML entity, and added support for RTL plus a span for styling.
if ($link_num != 0)
echo '
', $context['right_to_left'] ? ' ◄ ' : ' ► ', '';
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'], ' ';
// Show the link, including a URL if it should have one.
if (isset($tree['url']))
echo '
' . $tree['name'] . '';
else
echo '
' . $tree['name'] . '';
// Show something after the link...?
if (isset($tree['extra_after']))
echo ' ', $tree['extra_after'];
echo '
';
}
echo '
';
$shown_linktree = true;
}
/**
* Show the menu up top. Something like [home] [help] [profile] [logout]...
*/
function template_menu()
{
global $context;
echo '
';
// Note: Menu markup has been cleaned up to remove unnecessary spans and classes.
foreach ($context['menu_buttons'] as $act => $button)
{
echo '
';
}
/**
* Generate a strip of buttons.
*
* @param array $button_strip An array with info for displaying the strip
* @param string $direction The direction
* @param array $strip_options Options for the button strip
*/
function template_button_strip($button_strip, $direction = '', $strip_options = array())
{
global $context, $txt;
if (!is_array($strip_options))
$strip_options = array();
// Create the buttons...
$buttons = array();
foreach ($button_strip as $key => $value)
{
// As of 2.1, the 'test' for each button happens while the array is being generated. The extra 'test' check here is deprecated but kept for backward compatibility (update your mods, folks!)
if (!isset($value['test']) || !empty($context[$value['test']]))
{
if (!isset($value['id']))
$value['id'] = $key;
$button = '
'.(!empty($value['icon']) ? '' : '').'' . $txt[$value['text']] . '';
if (!empty($value['sub_buttons']))
{
$button .= '
';
}
$buttons[] = $button;
}
}
// No buttons? No button strip either.
if (empty($buttons))
return;
echo '
', implode('', $buttons), '
';
}
/**
* Generate a list of quickbuttons.
*
* @param array $list_items An array with info for displaying the strip
* @param string $list_class Used for integration hooks and as a class name
* @param string $output_method The output method. If 'echo', simply displays the buttons, otherwise returns the HTML for them
* @return void|string Returns nothing unless output_method is something other than 'echo'
*/
function template_quickbuttons($list_items, $list_class = null, $output_method = 'echo')
{
global $txt;
// Enable manipulation with hooks
if (!empty($list_class))
call_integration_hook('integrate_' . $list_class . '_quickbuttons', array(&$list_items));
// Make sure the list has at least one shown item
foreach ($list_items as $key => $li)
{
// Is there a sublist, and does it have any shown items
if ($key == 'more')
{
foreach ($li as $subkey => $subli)
if (isset($subli['show']) && !$subli['show'])
unset($list_items[$key][$subkey]);
if (empty($list_items[$key]))
unset($list_items[$key]);
}
// A normal list item
elseif (isset($li['show']) && !$li['show'])
unset($list_items[$key]);
}
// Now check if there are any items left
if (empty($list_items))
return;
// Print the quickbuttons
$output = '
';
// This is used for a list item or a sublist item
$list_item_format = function($li)
{
$html = '
';
// There are a few spots where the result needs to be returned
if ($output_method == 'echo')
echo $output;
else
return $output;
}
/**
* The upper part of the maintenance warning box
*/
function template_maint_warning_above()
{
global $txt, $context, $scripturl;
echo '