[Tip] Drop Down Menu Tutorial (..for all themes)

Started by Hoochie Coochie Man, August 05, 2008, 05:37:39 AM

Previous topic - Next topic

Vendetta7

Hiya folks!

This is exactly what I was looking for... only there are 20 pages to sort through this topic now, so frankly I don't know what is currently appropriate for my needs.   :(

I am running:  SMF 2.0 RC1.2  (fresh install)
Theme;  Pixel Perfect v1:  http://custom.simplemachines.org/themes/index.php?lemma=1903

Drop down menus on the main menu bar (admin bar is ok) don't seem to be present in the theme.  Frankly, no drop down menus seemed to work on the main menu bar for the default theme for SMF either.

I didn't notice this until I realized that I am in need of more menu links than the menu bar is wide...

If it isn't too much trouble, could someone post what is currently appropriate for activating / modding this feature into my current theme?  It would be EXTREMELY appreciated!

Thank you all, and again, sorry for bothering ya!

:D

Antechinus

I'll take a look at it. Can't do it immediately but give me 24 hours or so and I'll sort something out.


Shortie

Quote from: Vendetta7 on September 09, 2009, 07:16:38 PM
Hiya folks!

This is exactly what I was looking for... only there are 20 pages to sort through this topic now, so frankly I don't know what is currently appropriate for my needs.   :(

I am running:  SMF 2.0 RC1.2  (fresh install)
Theme;  Pixel Perfect v1:  http://custom.simplemachines.org/themes/index.php?lemma=1903

Drop down menus on the main menu bar (admin bar is ok) don't seem to be present in the theme.  Frankly, no drop down menus seemed to work on the main menu bar for the default theme for SMF either.

I didn't notice this until I realized that I am in need of more menu links than the menu bar is wide...

If it isn't too much trouble, could someone post what is currently appropriate for activating / modding this feature into my current theme?  It would be EXTREMELY appreciated!

Thank you all, and again, sorry for bothering ya!

:D

Okay you have a couple of options - if you are after the drop down menus which are present in Subs.php then a couple of edits and they will  be there but if you keep the menu centered then it adds a scroll bar to the bottom of your browser and it makes the theme look as though it is over sized - well that is option 1 now if you take this option and left align the menu then the scroll bar issue disappears so that option 2

these can be done but will need to add a couple more edit just to get the drop down items aligned

if this is what you are after let me know but if you are after additional menu items which are not generated by SMF then you will need to edit subs.php add them in and then decide how you want to display them not difficult to do just time consuming

hope this helps

Shortie


Vendetta7

Quote from: Shortie on September 09, 2009, 07:51:08 PM
Quote from: Vendetta7 on September 09, 2009, 07:16:38 PM
Hiya folks!

This is exactly what I was looking for... only there are 20 pages to sort through this topic now, so frankly I don't know what is currently appropriate for my needs.   :(

I am running:  SMF 2.0 RC1.2  (fresh install)
Theme;  Pixel Perfect v1:  http://custom.simplemachines.org/themes/index.php?lemma=1903

Drop down menus on the main menu bar (admin bar is ok) don't seem to be present in the theme.  Frankly, no drop down menus seemed to work on the main menu bar for the default theme for SMF either.

I didn't notice this until I realized that I am in need of more menu links than the menu bar is wide...

If it isn't too much trouble, could someone post what is currently appropriate for activating / modding this feature into my current theme?  It would be EXTREMELY appreciated!

Thank you all, and again, sorry for bothering ya!

:D

Okay you have a couple of options - if you are after the drop down menus which are present in Subs.php then a couple of edits and they will  be there but if you keep the menu centered then it adds a scroll bar to the bottom of your browser and it makes the theme look as though it is over sized - well that is option 1 now if you take this option and left align the menu then the scroll bar issue disappears so that option 2

these can be done but will need to add a couple more edit just to get the drop down items aligned

if this is what you are after let me know but if you are after additional menu items which are not generated by SMF then you will need to edit subs.php add them in and then decide how you want to display them not difficult to do just time consuming

hope this helps

Shortie



I am after Menu Items that are additional to the standard ones that SMF normally generates because of some Mods installed...

I understand what you are saying to a degree.  My issue is, exactly how to do it.  :\

Thank you for your help Shortie!

SoLoGHoST

Vendetta7, as Shortie has pointed out already, open Subs.php found in your Sources directory.  If you need to add menu items, this is the place to do it.  You can also add Submenu's in here if you want them too, however, this is not the case.  I'm shocked that the MOD's you have installed do not add the buttons in Subs.php already, since this is the only logical place to add buttons to the Main Menu in SMF 2.0.x (I believe same thing applies to SMF 1.1.x versions also).  You should take a look at this file and you will see all of the buttons you currently have on the Main menu in here.  They will be defined as arrays.  This is where you will add your buttons, and the placement of those buttons in here will determine the order in which the buttons appear on your forum.  Bro, this was among the 1st things I learned how to do and is very simple to understand, just open Subs.php and you will see.

Cheers :)

Shortie

Hi Ya

If you are going to edit subs.php

Have a search for something like this - This is the HELP menu option

'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),


As you can see it is made up from a couple of arrays which control how the menu is titled and what sub menus it has

so if we were to create a menu item call "I Want a Menu Item" with a number of Sub menus you will need some code like this - but you will need to change it to suit you enviroment (Here I agree with SoLo that a mod which installs should do these edit for you)

'my-unique-array-name' => array(
'title' => $txt['what-ever-you-want-to-call-me-needs-to-be-added-to-modifications.php'],
'href' => 'This is where you add the URL to the item you want displayed',
'show' => This is where you set any permissions - you can just enter true, if you want everyone to see it,
'sub_buttons' => array(
'another-unique-array-name' => array(
'title' => $txt['what-ever-you-want-to-call-me-needs-to-be-added-to-modifications.php'],
'href' => 'This is where you add the URL to the item you want displayed',
'show' => his is where you set any permissions - you can just enter true, if you want everyone to see it,
'sub_buttons' => array(
'another-unique-array-name' => array(
'title' => $txt['what-ever-you-want-to-call-me-needs-to-be-added-to-modifications.php'],
'href' => 'This is where you add the URL to the item you want displayed',
'show' => his is where you set any permissions - you can just enter true, if you want everyone to see it,
'sub_buttons' => array(
'another-unique-array-name' => array(
'title' => $txt['what-ever-you-want-to-call-me-needs-to-be-added-to-modifications.php'],
'href' => 'This is where you add the URL to the item you want displayed',
'show' => his is where you set any permissions - you can just enter true, if you want everyone to see it,
'sub_buttons' => array(
'another-unique-array-name' => array(
'title' => $txt['what-ever-you-want-to-call-me-needs-to-be-added-to-modifications.php'],
'href' => 'This is where you add the URL to the item you want displayed',
'show' => his is where you set any permissions - you can just enter true, if you want everyone to see it,
),
),
),


Now once you have the code put together you can place it anywhere within the

$buttons = array(

Which will enable you to change the order in which items are displayed


NOTE This is for SMF 2.x Branch

And I have done this from memory so there may be some odd formating errors but I am sure someone will enlighten me

Shortie

Matthew K.

What code do I remove in the index.template.php for version 1.1.10?

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

// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$current_action = 'admin';
if (in_array($context['current_action'], array('staff','tags','treasury','forum','search', 'bookmarks', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'banlist')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';



// EzPortal
if (isset($context['current_action2']))
$current_action = $context['current_action2'];

// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first = 'last';
$last = 'first';
}
else
{
$first = 'first';
$last = 'last';
}

// Show the start of the tab section.
echo '
<table align="center" cellpadding="0" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';

// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



// EzPortal Forum Button
global $ezpSettings;

if ($ezpSettings['ezp_portal_enable'] == 1)
echo ($current_action == 'forum' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'forum' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=forum">' , $txt['ezp_forum_tab'] , '</a>
</td>' , $current_action == 'forum' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// How about the [search] button?
if ($context['allow_search'])
echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'search' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
</td>' , $current_action == 'search' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'admin' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
</td>' , $current_action == 'admin' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">

<a href="', $scripturl, '?action=pm">' , 'Inbox' , $context['user']['unread_messages'] > 0 ? '&nbsp;[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>';
                   echo ' </td>' , $current_action == 'pm' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

    // The [bookmarks] button
if (allowedTo('make_bookmarks'))
echo ($current_action == 'bookmarks' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'bookmarks' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=bookmarks">' , 'Bookmarks' , '</a>
</td>' , $current_action == 'bookmarks' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The [calendar]!
if ($context['allow_calendar'])
echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'calendar' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
</td>' , $current_action == 'calendar' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The [recenttopics]!
echo ($current_action == 'recenttopics' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'recenttopics' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=recenttopics">' , $txt['recent_topics'] , '</a>
</td>' , $current_action == 'recenttopics' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [staff list] button
if ($context['allow_view_stafflist'])
echo ($current_action == 'staff' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'staff' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=staff">' , $txt['smfstaff_stafflist']  , '</a>
</td>' , $current_action == 'staff' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// the [tags] button
echo ($current_action == 'tags' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'tags' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=tags">' , $txt['smftags_menu']  , '</a>
</td>' , $current_action == 'tags' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// the [treasury] button
if ($context['allow_view_treasury'])
echo ($current_action == 'treasury' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_', $current_action == 'treasury' ? 'active_back' : 'back', '">
<a href="', $scripturl, '?action=treasury">', $txt['treasury_menu'], '</a>
</td>', $current_action == 'treasury' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



// the [banlist] list button
if ($context['allow_banlist'])
echo ($current_action == 'banlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'banlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=banlist">' , $txt['banlist_menu'] , '</a>
</td>' , $current_action == 'banlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
</td>' , $current_action == 'login' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The end of tab section.
echo '
<td class="maintab_' , $last , '">&nbsp;</td>
</tr>
</table>';

}


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

// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';

$button_strip[$key] = $buttons[$key];
}

if (empty($button_strip))
return '<td>&nbsp;</td>';

echo '
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'last' : 'first' , '">&nbsp;</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_back">', implode(' &nbsp;|&nbsp; ', $button_strip) , '</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'first' : 'last' , '">&nbsp;</td>';
}

?>


Thanks!

Matthew K.

Resolved!
Quote from: Labradoodle-360 on September 12, 2009, 02:21:02 PM
What code do I remove in the index.template.php for version 1.1.10?

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

// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$current_action = 'admin';
if (in_array($context['current_action'], array('staff','tags','treasury','forum','search', 'bookmarks', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'banlist')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action = 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';



// EzPortal
if (isset($context['current_action2']))
$current_action = $context['current_action2'];

// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first = 'last';
$last = 'first';
}
else
{
$first = 'first';
$last = 'last';
}

// Show the start of the tab section.
echo '
<table align="center" cellpadding="0" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';

// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



// EzPortal Forum Button
global $ezpSettings;

if ($ezpSettings['ezp_portal_enable'] == 1)
echo ($current_action == 'forum' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'forum' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=forum">' , $txt['ezp_forum_tab'] , '</a>
</td>' , $current_action == 'forum' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// How about the [search] button?
if ($context['allow_search'])
echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'search' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
</td>' , $current_action == 'search' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'admin' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
</td>' , $current_action == 'admin' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'profile' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>' , $current_action == 'profile' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pm' ? 'active_back' : 'back' , '">

<a href="', $scripturl, '?action=pm">' , 'Inbox' , $context['user']['unread_messages'] > 0 ? '&nbsp;[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>';
                   echo ' </td>' , $current_action == 'pm' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

    // The [bookmarks] button
if (allowedTo('make_bookmarks'))
echo ($current_action == 'bookmarks' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'bookmarks' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=bookmarks">' , 'Bookmarks' , '</a>
</td>' , $current_action == 'bookmarks' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The [calendar]!
if ($context['allow_calendar'])
echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'calendar' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
</td>' , $current_action == 'calendar' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The [recenttopics]!
echo ($current_action == 'recenttopics' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'recenttopics' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=recenttopics">' , $txt['recent_topics'] , '</a>
</td>' , $current_action == 'recenttopics' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// the [staff list] button
if ($context['allow_view_stafflist'])
echo ($current_action == 'staff' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'staff' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=staff">' , $txt['smfstaff_stafflist']  , '</a>
</td>' , $current_action == 'staff' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// the [tags] button
echo ($current_action == 'tags' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'tags' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=tags">' , $txt['smftags_menu']  , '</a>
</td>' , $current_action == 'tags' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// the [treasury] button
if ($context['allow_view_treasury'])
echo ($current_action == 'treasury' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_', $current_action == 'treasury' ? 'active_back' : 'back', '">
<a href="', $scripturl, '?action=treasury">', $txt['treasury_menu'], '</a>
</td>', $current_action == 'treasury' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



// the [banlist] list button
if ($context['allow_banlist'])
echo ($current_action == 'banlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'banlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=banlist">' , $txt['banlist_menu'] , '</a>
</td>' , $current_action == 'banlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'login' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
</td>' , $current_action == 'login' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'register' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>' , $current_action == 'register' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'logout' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>' , $current_action == 'logout' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// The end of tab section.
echo '
<td class="maintab_' , $last , '">&nbsp;</td>
</tr>
</table>';

}


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

// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';

$button_strip[$key] = $buttons[$key];
}

if (empty($button_strip))
return '<td>&nbsp;</td>';

echo '
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'last' : 'first' , '">&nbsp;</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_back">', implode(' &nbsp;|&nbsp; ', $button_strip) , '</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'first' : 'last' , '">&nbsp;</td>';
}

?>


Thanks!

Matthew K.

I would suggest adding border-bottom: 1px solid black; to div#menu ul.menu ul

Here is what that looks like:


As you can see it adds a nice finishing touch to a nice menu!

Sabre™

Hello peeps,
I've just started really getting into the layout of smf2(boy have alot of things changed!), and by reading this thread Ive figured out how to add dropdown menus to my theme(s).
But, Im a little stuck on how to get a dropdown such as this
eg.

home
  - help
  - rules

profile
  - forum
  - account
  - messages - inbox
             - sent

calendar

etc etc etc...


The css section is relatively forward, as not much has changed in that regard, it is just trying to figure out what to put in the subs.php, or even if there is another file that needs modifying.
I've touched on  'subsections' => array(   but as stated, Im only just getting into smf2 and dont even know if that has any bearing on this.

Just using the profile array as an example, could somebody possibly point me in the right direction please?
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),
'account' => array(
'title' => $txt['account'],
'href' => $scripturl . '?action=profile;area=account',
'show' => allowedTo(array('profile_identity_any', 'profile_identity_own', 'manage_membergroups')),
),
'profile' => array(
'title' => $txt['forumprofile'],
'href' => $scripturl . '?action=profile;area=forumprofile',
'show' => allowedTo(array('profile_extra_any', 'profile_extra_own')),
),
),
),


I know how to sit the messages etc array in there, but how to get to the above example is a mystery for me at the moment.

Thanks in advance for any assistance :)

regards
Do NOT give admin and/or ftp details to just anybody, see if they are trust worthy first!!  Do your homework ;)


naiTao

I will try this sulution and if i have any problem i will back, again.

thank your for your code.

Arantor

Holder of controversial views, all of which my own.


dkharp

#413
Greetings!

I am running smf 1.1.10 / TinyPortal v1.0 beta 4
http://www.36thid.info

WOOWEE! This looks great!  I have one question.  How do you make the buttons (tabs) closer together so you can add more?




dkharp

#414
How do you remove the help button (tab) off?

Dave009

#415
For above post
open Sources/Subs.php

find
'help' => array(
            'title' => $txt['help'],
            'href' => $scripturl . '?action=help',
            'show' => true,
            'sub_buttons' => array(
            ),
         ),


and remove thats what i did

My Question about dropdown
im trying to create a dropdown menu i read forum and followed guide im using SMF RC1.2 to create this dropdown menu.  the button appears but no dropdown appears can someone tell me if it is if you need files i get them i bet its something to do with css (css hates me for some reason lol)
i am using custom themes quite a few of them but the one thats at the top of the list is black rain v2

SoLoGHoST

It's actually in the buttons array within the 'sub_buttons' index array in Sources/Subs.php.  Look at how the other one's do it and you should be able to follow their examples on this.

Dave009

i know that much lol
smf 2 rc1.2 allready has the code
sample from my subs.php
'mlist' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=mlist',
'show' => $context['allow_memberlist'],
'sub_buttons' => array(
'mlist_view' => array(
'title' => $txt['mlist_menu_view'],
'href' => $scripturl . '?action=mlist',
'show' => true,
),
'mlist_search' => array(
'title' => $txt['mlist_search'],
'href' => $scripturl . '?action=mlist;sa=search',
'show' => true,
),
),
),

[unplugged]

To remove a button from the menu, you could just change

     'show' => true,     to     'show' => false,

This way, if you ever decide to display the button again, you don't have to worry about what code was deleted or where to put it, simple change false back to true.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Nameless?

#419
im using smf 2.0 rc1.2 and i need something like this:

Main
- Home
- Staff
- Contact us
- Arcade


Community
- Forums


etc.

please, would be great to get help with this.
Thanks

Advertisement: