Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Tabbuttons

Aloittaja VyrOn, heinäkuu 21, 2011, 06:00:05 AP

« edellinen - seuraava »

VyrOn

Hello,

I just downloaded "LikeVB4". It's a theme that looks exactly like the vBulletin 4 theme. ;) (It has no support topic, though)

My tabbar is looking like this:



So you see 4 buttons on the tabbar and the other links are in small font below.

My question now is: how can I configure which buttons are on the bar and which links are below? I think it has to do something with this script and the amount of buttons on the bar. I'm not so good at PHP so I was hoping someone could explain this to me how I can configure the buttons on that bar.

index.template.php
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

echo '
<div id="main_menu">
<ul class="dropmenu custommenu" id="menu_nav">';

foreach ($context['menu_buttons'] as $act => $button)
{
if (empty($button['sub_buttons']))
{
echo '
<li id="button_', $act, '" class="', $button['active_button'] ? 'activ' : '', '">
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
', $button['title'], '
</a>
</li>';
}
}

echo '
</ul>
</div>
<div id="submenu">
<ul class="dropmenu sub_menu">';

foreach ($context['menu_buttons'] as $act => $button)
{
if (!empty($button['sub_buttons']))
{
echo '
<li id="button_', $act, '">
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
', $button['title'], '
</a>';
if (!empty($button['sub_buttons']))
{
echo '
<ul>';

foreach ($button['sub_buttons'] as $childbutton)
{
echo '
<li>
<a href="', $childbutton['href'], '"', isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '>
', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '
</a>';
// 3rd level menus :)
if (!empty($childbutton['sub_buttons']))
{
echo '
<ul>';

foreach ($childbutton['sub_buttons'] as $grandchildbutton)
echo '
<li>
<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
', $grandchildbutton['title'], '
</a>
</li>';

echo '
</ul>';
}

echo '
</li>';
}
echo '
</ul>';
}
echo '
</li>';
}
}

echo '<li></li>
</ul>
</div>';
}

// Generate a strip of buttons.
function template_button_strip($button_strip, $direction = 'top', $strip_options = array())
{
global $settings, $context, $txt, $scripturl;

if (!is_array($strip_options))
$strip_options = array();

// List the buttons in reverse order for RTL languages.
if ($context['right_to_left'])
$button_strip = array_reverse($button_strip, true);

// Create the buttons...
$buttons = array();
foreach ($button_strip as $key => $value)
{
if (!isset($value['test']) || !empty($context[$value['test']]))
$buttons[] = '
<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>';
}

// No buttons? No button strip either.
if (empty($buttons))
return;

// Make the last one, as easy as possible.
$buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);

echo '
<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
<ul>',
implode('', $buttons), '
</ul>
</div>';
}


My complete index.template.php is also in an attachment.

Thanks in advance!

- Vyron

MrGrumpy

That menu is designed so any buttons that have a submenu's are on the bottom and menu buttons that have no submenu's are placed on the top row.
the possession of knowledge is worthless unless imparted upon others
My Custom Themes
2.0 themes only - I don't do 1.1.x

VyrOn

Ohh, now I get it!! Thanks so much, really appreciated!!!!

+1 Thanks! :D

Advertisement: