Possible Tip for Tips/Tricks board?
Ok, so I noticed how SMF has 2 dropdown menus (one for the community forum which is in Curve already, and one in the header Home, Community, Download, Customize, etc... which is not included in Curve). So I modified it to add another menu to the header much like SMF does there menu.
Demo (http://www.bnetweb.org/dev/index.php)
This Tip is moderate/advanced to accomplish entirely. Follow the steps and you should be able to figure out the rest.
Thanks to ElectricSquid (http://www.simplemachines.org/community/index.php?action=profile;u=130276) for finding the location of the dropdown in Subs.php
Step 1:
In /Themes/default/index.template.php
Find:
function template_menu()
Add Before:
// Show the menu up top. The header navigation
function template_menu_top()
{
global $context, $settings, $options, $scripturl, $txt;
echo '
<div id="site_menu" class="align_right">
<ul class="dropmenu" id="site_nav">';
foreach ($context['custom_menu_buttons'] as $act => $button)
{
echo '
<li id="button_', $act, '">
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
<span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
</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'] . '"' : '', '>
<span', isset($childbutton['is_last']) ? ' class="last"' : '', '>', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '</span>
</a>';
// 3rd level menus :)
if (!empty($childbutton['sub_buttons']))
{
echo '
<ul>';
foreach ($childbutton['sub_buttons'] as $grandchildbutton)
echo '
<li>
<a', $grandchildbutton['active_button'] ? ' class="active"' : '', ' href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
<span', isset($grandchildbutton['is_last']) ? ' class="last"' : '', '>', $grandchildbutton['title'], '</span>
</a>
</li>';
echo '
</ul>';
}
echo '
</li>';
}
echo '
</ul>';
}
echo '
</li>';
}
echo '
</ul>
</div>';
}
Find:
', 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="align_right">' . $settings['site_slogan'] . '</div>', '
Replace With:
', template_menu_top(), '
Step 2:
In /Sources/Subs.php
Find:
$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}
Add After:
// Header Menu Dropdown Begin.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttonsTop = array(
'menu1' => array(
'title' => 'Menu 1',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'sub_menu1' => array(
'title' => 'Sub Menu 1',
'href' => $scripturl,
'show' => true,
),
'sub_menu2' => array(
'title' => 'Sub Menu 2',
'href' => $scripturl,
'show' => true,
),
'sub_menu3' => array(
'title' => 'Sub Menu 3',
'href' => $scripturl,
'show' => true,
),
),
),
'menu2' => array(
'title' => 'Menu 2',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'sub_menu4' => array(
'title' => 'Sub Menu 4',
'href' => $scripturl,
'show' => true,
),
'sub_menu5' => array(
'title' => 'Sub Menu 5',
'href' => $scripturl,
'show' => true,
),
),
),
'menu3' => array(
'title' => 'Menu 3',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
);
// Now we put the buttons in the context so the theme can use them.
$menu_buttonsTop = array();
foreach ($buttonsTop as $act => $button)
if (!empty($button['show']))
{
$button['active_button'] = false;
// Make sure the last button truely is the last button.
if (!empty($button['is_last']))
{
if (isset($last_button))
unset($menu_buttonstop[$last_button]['is_last']);
$last_button = $act;
}
// Go through the sub buttons if there are any.
if (!empty($button['sub_buttons']))
foreach ($button['sub_buttons'] as $key => $subbutton)
{
if (empty($subbutton['show']))
unset($button['sub_buttons'][$key]);
}
$menu_buttonsTop[$act] = $button;
}
if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttonstop, $cacheTime);
}
$context['custom_menu_buttons'] = $menu_buttonsTop;
// Header Menu Dropdown End.
Step 3:
In /Themes/default/css/index.css
Find:
#top_section
{
min-height: 65px;
overflow: hidden;
margin-bottom: 3px;
}
Replace With:
#top_section
{
min-height: 65px;
/*overflow: hidden;*/
margin-bottom: 3px;
}
#site_menu
{
padding: 12px 0 4px 1em;
margin: 0;
/*overflow: hidden;*/
font-size: 1.1em;
font-family: tahoma, sans-serif;
}
h1.forumtitle
{
font-family: "Century Gothic", tahoma, sans-serif;
position: absolute;
}
#main_menu
{
margin-top: 1em;
}
#site_nav li a.active
{
background: url(../images/theme/menu_gfx.png) no-repeat 100% -31px;
}
#site_nav li a.active span.firstlevel
{
background: url(../images/theme/menu_gfx.png) no-repeat 0 -31px;
}
Step 4:
Go back into /Sources/Subs.php and edit the menu items you added from this tutorial. For example to change 'Menu 1' to 'About Us' with some links
Find:
'menu1' => array(
'title' => 'Menu 1',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'sub_menu1' => array(
'title' => 'Sub Menu 1',
'href' => $scripturl,
'show' => true,
),
'sub_menu2' => array(
'title' => 'Sub Menu 2',
'href' => $scripturl,
'show' => true,
),
'sub_menu3' => array(
'title' => 'Sub Menu 3',
'href' => $scripturl,
'show' => true,
),
),
),
Replace With:
'about_us' => array(
'title' => 'About Us',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
'member_list' => array(
'title' => 'Member List',
'href' => $scripturl . '?action=mlist',
'show' => true,
),
'search_site' => array(
'title' => 'Search',
'href' => $scripturl . '?action=search',
'show' => true,
),
'help_us' => array(
'title' => 'Help',
'href' => $scripturl . '?action=help',
'show' => true,
),
),
),
Step 5:
Done!
You can add as many menu items and sub items as you want, just be sure to edit Subs.php accordingly.
Attached is a screenshot of the customization when its complete. If you have any questions regarding this tip, please respond to this topic, no pm support.
I have only tested this on the default Curve theme, if you use a custom theme your results might vary.
Updated 2/25/2010: Fixed the issue with only being able to have 4 or so menu items. Should be able to use as many as you like.
Updated 3/9/2010: Updated to work with 2.0RC3 and also fixed issue of word wrapping to a new line. Should be fully functional now
Enjoy!
Thank for this tutorial and I will be working on this one.
Quote from: Dismal Shadow on January 15, 2010, 02:20:27 AM
Thank for this tutorial and I will be working on this one.
no problem, let me know how it goes :)
Well, works perfectly on every SMF 2.x engine, good work. You're a star.
Thanks a million!
indeed, very good tip, thanks a lot buddy
Cheers mate, I'll be using this for sure! :)
It works, but I can't add more than 4 tabs or else it will look like this:
Quote from: Dismal Shadow on February 07, 2010, 03:40:18 PM
It works, but I can't add more than 4 tabs or else it will look like this:
yeah i had that same problem :(
I wonder how SMF did with 9 tabs :o
Nice tip! Ping for later reading...
BTW...I believed the editing in index.css isn't needed since it works fine without it and also mess up the header related here:
http://www.simplemachines.org/community/index.php?topic=364715.msg2492256#msg2492256
@Dismal Shadow: I am working on a fix to be able to add more tabs to the header. Also, the edit in index.css is needed as it will just align on the top if not used, you have to tweak to your settings when using a logo that doesn't match SMF2.0 default theme.
I am no CSS wizard, and that's the only problem causing the multiple tab issues, so hopefully I'll find the underlying cause because it is "Supposed" to align on the right but when I tweak it it goes to the left. If anyone would like to take a stab at it be my guest and I'll update the existing code. I'm still fiddling with it.
Quote from: ScopeXL on February 07, 2010, 11:48:17 PM
@Dismal Shadow: I am working on a fix to be able to add more tabs to the header. Also, the edit in index.css is needed as it will just align on the top if not used, you have to tweak to your settings when using a logo that doesn't match SMF2.0 default theme.
That's what I did...
#top_section
{
min-height: 65px;
/*overflow: hidden;*/
margin-bottom: 3px;
}
I changed 65px to 120px and it works beautiful.
I was hoping someone would make it into a mod, but I guess it's not worth it since this tip is not so hard.
http://www.simplemachines.org/community/index.php?topic=362589.0
I was asked if someone could turn this into a mod, I agreed. I have yet to hear from that person on progress of it. Hopefully I can fix the width of the tab bar to stretch across the entire header, which is easy, but for some reason it won't align on the right. So its being a pain.
Quote from: Dismal Shadow on February 08, 2010, 12:02:13 AM
Quote from: ScopeXL on February 07, 2010, 11:48:17 PM
@Dismal Shadow: I am working on a fix to be able to add more tabs to the header. Also, the edit in index.css is needed as it will just align on the top if not used, you have to tweak to your settings when using a logo that doesn't match SMF2.0 default theme.
That's what I did...
#top_section
{
min-height: 65px;
/*overflow: hidden;*/
margin-bottom: 3px;
}
I changed 65px to 120px and it works beautiful.
I was hoping someone would make it into a mod, but I guess it's not worth it since this tip is not so hard.
http://www.simplemachines.org/community/index.php?topic=362589.0
nice tip ty
wait no that changes the wrong bit lol how do we get more on one line?
@ppbz: That hasn't been fixed yet.
ok but isn't it just a matter of making that space at the top right a little bigger?
You would think so, but no. Making it a little bigger won't fix everyone's problem. So I'm attempting to make it 100% wide and align it on the right by default, which isn't going so well. A quick fix would be to add width: XXXpx; to the #siteslogan CSS and edit the width to whatever size you need, but you'll need to change it with every tab you decide to add.
Quote from: ScopeXL on February 08, 2010, 12:23:41 AM
You would think so, but no. Making it a little bigger won't fix everyone's problem. So I'm attempting to make it 100% wide and align it on the right by default, which isn't going so well. A quick fix would be to add width: XXXpx; to the #siteslogan CSS and edit the width to whatever size you need, but you'll need to change it with every tab you decide to add.
yeah i did change it to 27px and it looks good for me but for people with different screen sizes it still drops it onto a new line
wait nm that was 27% i think i use but px works fine thank you :)
The reason I make it bigger because of my logo which is why it messed up with the header as shown in the image so I change it to 120. It depend how big logo you have. ;)
Excellent Tutorial. Thanks a ton. :)
can i be honest and say im not to good with the code and i always mess it up, is there not a package?
also can i make a forum or a section look work like this:
http://gta-worldmods.t-n-network.de/phpkit/start/include.php?path=content/overview.php&catid=50&type=4
because i want it to show the main images and a short description
ScopeXL, is there any way to hide lines from guests?
Quote from: Dismal Shadow on February 25, 2010, 06:43:36 PM
ScopeXL, is there any way to hide lines from guests?
I assume you mean hide a link from a guest? If so then yes. Simply change the array in Subs.php for the link you want hidden
'sub_menu2' => array(
'title' => 'Sub Menu 2',
'href' => $scripturl,
'show' => true,
),
Should look like
'sub_menu2' => array(
'title' => 'Sub Menu 2',
'href' => $scripturl,
'show' => !$user_info['is_guest'],
),
All that really changes is the 'show'. make it !$user_info['is_guest'] for members eyes only, and $user_info['is_guest'] for guests eyes only.
@diamondred123: I am not sure what you are asking. I don't see any resemblance to my navigation trick on that URL. If you need help adding the navigation, PM me and I can assist you. But as for a package there is not one. Labradoodle-360 asked to make it a package, but as of now I have not heard much about it.
Quote from: ScopeXL on February 25, 2010, 07:18:17 PM
Quote from: Dismal Shadow on February 25, 2010, 06:43:36 PM
ScopeXL, is there any way to hide lines from guests?
I assume you mean hide a link from a guest? If so then yes. Simply change the array in Subs.php for the link you want hidden
'sub_menu2' => array(
'title' => 'Sub Menu 2',
'href' => $scripturl,
'show' => true,
),
Should look like
'sub_menu2' => array(
'title' => 'Sub Menu 2',
'href' => $scripturl,
'show' => !$user_info['is_guest'],
),
All that really changes is the 'show'. make it !$user_info['is_guest'] for members eyes only, and $user_info['is_guest'] for guests eyes only.
Thank you, you are a genius.
I have fixed the issue with only being able to show 4 or show menu items. Use this fix ONLY if you have made the first edits prior to this fix. I have updated my original post with the new code. Heres the fix for those of you who are already using my trick.
In /Themes/default/index.template.php
Find:
function template_menu_top()
{
global $context, $settings, $options, $scripturl, $txt;
echo '
<div id="main_menu">
<ul class="dropmenu" id="main_nav">
Replace with:
function template_menu_top()
{
global $context, $settings, $options, $scripturl, $txt;
echo '
<div id="main_menu">
<ul class="dropmenu" id="main_nav" style="float:right;">
In /Themes/default/css/index.css
Find:
#siteslogan, img#smflogo
{
margin-top: 15px;
padding: 0;
float: right;
line-height: 3em;
}
Replace with:
#siteslogan, img#smflogo
{
margin-top: 15px;
padding: 0;
float: right;
line-height: 3em;
width: 75%;
}
You should be able to add as many links as you want now. Keep in mind that users with smaller resolutions may see overflow, so don't add a ton of them. 8 or 9 should be fine considering most computers now have larger resolutions.
If for some reason your site doesn't properly display the menu, (i.e. the menu wraps down a line) then change the width of #siteslogan in index.css to a percent or pixel that fits your needs.
Any other bugs or requests let me know.
I welcome any coders to make this into a modification, just let me know.
What about the tabs? Are you saying this code now has the ability to have more than 4 tabs?
Quote from: Dismal Shadow on February 25, 2010, 09:10:11 PM
What about the tabs? Are you saying this code now has the ability to have more than 4 tabs?
Yes, Click here for the demo with more than 4 tabs. (http://www.bnetweb.org/dev/index.php)
will this ever get changed into a mod?
Quote from: zx71 on February 25, 2010, 09:15:33 PM
will this ever get changed into a mod?
I don't have the time at the moment to create the admin options to create, delete, or modify navigation items, if someone would like to partner with me I can certainly help with the mod creation, but I am not familiar enough with SMF mod coding to package it and do everything myself. If I had time to read up on it maybe, but as of right now I cannot.
Quote from: ScopeXL on February 25, 2010, 09:12:33 PM
Quote from: Dismal Shadow on February 25, 2010, 09:10:11 PM
What about the tabs? Are you saying this code now has the ability to have more than 4 tabs?
Yes, Click here for the demo with more than 4 tabs. (http://www.bnetweb.org/dev/index.php)
Jesus Christ...awesome.
my one said to me:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\Inetpub\webroot\version2test\Sources\Subs.php on line 4066
and yes it is hosted off a pc, and what can i do to fix this? thanks
Quote from: diamondred123 on March 02, 2010, 04:26:05 PM
my one said to me:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in C:\Inetpub\webroot\version2test\Sources\Subs.php on line 4066
you missed a ')' when editting the Subs.php file, look over that tab, make sure each array you open is closed. Attach your Subs.php file and I can fix it for you if you cannot find it.
ok man i did that file again and said:
Parse error: syntax error, unexpected $end in C:\Inetpub\webroot\version2test\Sources\Subs.php on line 3657
This had a big impact on netbook because of its resolution.
I tried to change CSS;
the #top_section's min-height and #siteslogan, img#smflogo's width.
but it doesn't really do good. My logo is also big. I hope there's a fix for it.
The site is http://thetwoworldsforum.com
Quote from: Dismal Shadow on March 05, 2010, 05:37:03 AM
This had a big impact on netbook because of its resolution.
I tried to change CSS;
the #top_section's min-height and #siteslogan, img#smflogo's width.
but it doesn't really do good. My logo is also big. I hope there's a fix for it.
The site is http://thetwoworldsforum.com
Please let me know the resolution you are experiencing problems with so I can debug on my end.
Quote from: ScopeXL on March 05, 2010, 05:43:50 AM
Quote from: Dismal Shadow on March 05, 2010, 05:37:03 AM
This had a big impact on netbook because of its resolution.
I tried to change CSS;
the #top_section's min-height and #siteslogan, img#smflogo's width.
but it doesn't really do good. My logo is also big. I hope there's a fix for it.
The site is http://thetwoworldsforum.com
Please let me know the resolution you are experiencing problems with so I can debug on my end.
Simple, Netbooks. They are mostly small.
Look at SM.org here and Dream Portal's dropdown which had no affect because they use a different code somehow.
In index.css, under #siteslogan, img#smflogo, change width: 75%; to width: 60%; That should fix all resolution problems. If you are still having problems try width: 50%; and lower and lower until it works with your logo.
Quote from: ScopeXL on March 05, 2010, 12:35:54 PM
In index.css, under #siteslogan, img#smflogo, change width: 75%; to width: 60%; That should fix all resolution problems. If you are still having problems try width: 50%; and lower and lower until it works with your logo.
50% works for me but unless they have smaller resolution it will look like this. Your demo site shows the same.
It all is relevant to how many tabs you use, as well as the width of the #siteslogan in the index.css, if you make the width: attribute to a fixed pixel or percentage (low enough) for users with smaller resolutions shouldn't have a problem. However I have not been able to recreate the way SMF does it yet that disables wordwrap so the navigation doesn't scroll to the next line if the resolution is small. Once I see how the CSS is parsed to not allow word wrap I will rewrite my demo and make necessary changes. For now though, a quick fix is reduce your width: attribute of #siteslogan in index.css
Ok i have disabled this and put in default until there's a fix for this and I also believed it's my logo. Is there any way to put the logo other than "Logo image URL:" in the theme setting. Or does that affect either way no matter where I put the logo?
Quote from: Dismal Shadow on March 08, 2010, 02:56:58 AM
Ok i have disabled this and put in default until there's a fix for this and I also believed it's my logo. Is there any way to put the logo other than "Logo image URL:" in the theme setting. Or does that affect either way no matter where I put the logo?
It could be your logo, if you would allow me I can better debug this if I had your theme files. Simply zip your theme directory and send to me and I can fiddle with it until it seems to be working on all resolutions.
Quote from: ScopeXL on March 08, 2010, 08:22:02 AM
Quote from: Dismal Shadow on March 08, 2010, 02:56:58 AM
Ok i have disabled this and put in default until there's a fix for this and I also believed it's my logo. Is there any way to put the logo other than "Logo image URL:" in the theme setting. Or does that affect either way no matter where I put the logo?
It could be your logo, if you would allow me I can better debug this if I had your theme files. Simply zip your theme directory and send to me and I can fiddle with it until it seems to be working on all resolutions.
Cool, where do you want it attached or upload to?
Attach it in a reply to this, I'll reattach when I can see whats up with it.
Ummm...I don't think we can attach here...it's not in the additional options... :-\
Quote from: Dismal Shadow on March 08, 2010, 08:37:09 AM
Ummm...I don't think we can attach here...it's not in the additional options... :-\
My bad, either provide a zip from your web server or use Megaupload.com
Updated for 2.0 RC3
Also fixed the problem users were having with menu items word wrapping to next line if screen resolutions were too small.
Quote from: ScopeXL on March 09, 2010, 07:43:52 PM
Updated for 2.0 RC3
Also fixed the problem users were having with menu items word wrapping to next line if screen resolutions were too small.
By looking at your demo it seem to have fixed indeed. Now I wonder how the logo would fare in this. Will test it later.
Update: Whatdidya know? It works. :)
Thank you for this guide. Really THANK YOU!
I have a design questions pertaining to this awesome tip.
I'm using all external links. So there wont be an active tab. Is there a way to make them all show the active tab behind the text? If that isn't possible is there a css edit I can make so that just the top menu is in slightly larger white text, and possibly bold?
Thanks for any help you can provide.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi39.tinypic.com%2F5f2nv7.png&hash=ff3d84cf9afe33dfb7e21f7c3344403a474ae0ee)
Quote from: MarcusJ on March 15, 2010, 11:27:36 AM
I have a design questions pertaining to this awesome tip.
I'm using all external links. So there wont be an active tab. Is there a way to make them all show the active tab behind the text? If that isn't possible is there a css edit I can make so that just the top menu is in slightly larger white text, and possibly bold?
Thanks for any help you can provide.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi39.tinypic.com%2F5f2nv7.png&hash=ff3d84cf9afe33dfb7e21f7c3344403a474ae0ee)
You mean this?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi43.tinypic.com%2F6r573r.png&hash=486b6b472c57b9b75f0620b095a67eaa69f55add)
I too would like to see this as well.
Yes that. :D Or the css edit to make the text lighter and larger. I'm easy. I just wish I had the knowledge to do it on my own.
The CSS for it is in index.css and I'm not sure in particular but I believe its .dropmenu (or one of .dropmenu's subitems). For this tutorial I left out active tab to keep it simple for others using it as you would have to specify each action to get active tabs correctly working. If your using external links then look for
Find:
.dropmenu li a.active
And that should be the CSS for the active tab for whatever theme your using. Then change
Find:
.dropmenu li
in the CSS and replace the active tab CSS with the standard CSS which *should* make your tabs default to looking like active tabs. I don't have time right now to test this, make sure to save an original index.css backup if things go really, really wrong. Let me know how it works out and I might have time later to test this and help you out if my theory doesn't work.
I tried it. But it didn't work out so well. :o
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi40.tinypic.com%2Fizuftl.png&hash=ed3589b1556c1265524a1a488178263929c6f498)
lol
Holy cow. :o
You know I'd be really happy just being able to change the color of those links. Seeing as active tabs wont work for external links anyway.
I've spent about an hour trying to sort it, but I'm defeated. It is beyond my meager understanding. :o
i've got this error in my error log MANY times...
QuoteApply Filter: Only show the error messages of this member [removed]
Apply Filter: Only show the error messages of this IP address [removed]
Reverse chronological order of list Today at 11:50:21 pm
Apply Filter: Only show the error messages of this session [removed]
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://[removed].com/index.php?action=login2
Apply Filter: Only show the errors with the same message
8: Undefined index: href
Apply Filter: Only show the errors from this file
File: /var/www/web8/web/Themes/default/index.template.php
Line: 541
this is line 541 of index.template.php
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
Did you by any chance put a link in your top navigation drop down that doesn't link to anything? Look through your Subs.php where you put in the links yourselfs. Compare with this one link make sure they all have each item.
'link_idr' => array(
'title' => 'Link 1',
'href' => $scripturl . '?action=link',
'show' => true,
'sub_buttons' => array(
),
),
Quote from: ScopeXL on March 24, 2010, 10:54:17 PM
Did you by any chance put a link in your top navigation drop down that doesn't link to anything? Look through your Subs.php where you put in the links yourselfs. Compare with this one link make sure they all have each item.
'link_idr' => array(
'title' => 'Link 1',
'href' => $scripturl . '?action=link',
'show' => true,
'sub_buttons' => array(
),
),
they all look like that... can i pm you what i have so you can check it?
sure.
Fixed. Check PM for solution.
I believe I'll try this tmr.
Thanx for the tutorial. :)
April
Sorry, I don't want to hijack this thread. Is there a mod for adding the top menu without the drop downs?
I just need 4 simple external links added like there is at the top of this forum. I have spent 3 hrs looking.
Thanks for your help.
Quote from: sontar on April 01, 2010, 10:37:15 AM
Sorry, I don't want to hijack this thread. Is there a mod for adding the top menu without the drop downs?
I just need 4 simple external links added like there is at the top of this forum. I have spent 3 hrs looking.
Thanks for your help.
This tip you can achieve that. Here is a sample for the Subs.php $buttonsTop array for 4 links with no dropdowns.
'menu1' => array(
'title' => 'Menu 1',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'menu2' => array(
'title' => 'Menu 2',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'menu3' => array(
'title' => 'Menu 3',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'menu4' => array(
'title' => 'Menu 4',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
Thank you very much!
Quote from: Scope XL on April 01, 2010, 12:16:30 PM
Quote from: sontar on April 01, 2010, 10:37:15 AM
Sorry, I don't want to hijack this thread. Is there a mod for adding the top menu without the drop downs?
I just need 4 simple external links added like there is at the top of this forum. I have spent 3 hrs looking.
Thanks for your help.
This tip you can achieve that. Here is a sample for the Subs.php $buttonsTop array for 4 links with no dropdowns.
'menu1' => array(
'title' => 'Menu 1',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'menu2' => array(
'title' => 'Menu 2',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'menu3' => array(
'title' => 'Menu 3',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'menu4' => array(
'title' => 'Menu 4',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
care to explain alittle?
Do all the edits from the first post expect for subs.php if you don't want dropdown then use the codes above me in the subs.php instead of the subs.php codes in the first post.
I'm amazed that nobody has turned this gem into a mod yet!
Probably because they don't want to do with all of the support comments for non-curve themes, that may be why no-ones modified it ^_^
I love this trick and am using it on all of my sites to link to one-another (kind of like affiliating), this is in the perfect place to do it ;)
iKorp has it exactly right. The number of non Curve themes this would have to be applied to manually (even considering 2.0's better support for doing it) is beyond irritating.
Yeah, just like Ultimate Portal (http://ultimate-portal.net/) (which is going along great) is doing, including the top menu as a module, we're going to get ALOT of complaints about that from non-curve users so we're finding a way to define Curve themes to see if we can find a default way around it (maybe just static links just below <body>)...
Lovely tip. =D
This is awsome ... thank you my friend
Great tip. Tagging for future reference.
I really like the way this displays in the Curve theme. I have mine setup without the submenus and it works great. I tried to do the same to the Core theme , but it displays vertically instead of horizontally. All the links are working but I need the menus to run horizontally and display them like the Core tabs . Not sure what to change.
Quote from: USAFged on May 16, 2010, 01:53:48 PM
I really like the way this displays in the Curve theme. I have mine setup without the submenus and it works great. I tried to do the same to the Core theme , but it displays vertically instead of horizontally. All the links are working but I need the menus to run horizontally and display them like the Core tabs . Not sure what to change.
The core theme and curve theme's CSS differs greatly. Basically it would have to be a different set of steps to incorporate this into Core (without the drop down magic).
I like this, how do I get this on my forum? will I need to edit all the code?
Quote from: Scope XL on May 17, 2010, 12:38:56 AM
Quote from: USAFged on May 16, 2010, 01:53:48 PM
I really like the way this displays in the Curve theme. I have mine setup without the submenus and it works great. I tried to do the same to the Core theme , but it displays vertically instead of horizontally. All the links are working but I need the menus to run horizontally and display them like the Core tabs . Not sure what to change.
The core theme and curve theme's CSS differs greatly. Basically it would have to be a different set of steps to incorporate this into Core (without the drop down magic).
Didn't see this earlier but it's not hard to do. Core doesn't include the dropmenu classes that this relies on. If you copy all the dropmenu classes from Curve's css to Core's css it should work (although you will still need a suitable button image).
bidzinski, follow the instructions on the first page of the thread.
Quote from: bidzinski on June 03, 2010, 07:01:23 AM
I like this, how do I get this on my forum? will I need to edit all the code?
From the first post, yes.
hi all i've been getting these errors in my error log and have no idea how to fix them:
http://domain.com/index.php?action=search2
8: Undefined index: href
File: /var/www/Themes/default/index.template.php
Line: 618
http://domain.com/index.php?action=search2
8: Undefined index: title
File: /var/www/Themes/default/index.template.php
Line: 619
(i also get the above two errors for http://domain.com/index.php?action=register2)
and here's line 618 and 619:
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
<span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
would appreciate any help with this thank you :)
I wonder if perhaps someone could help me please?
I have a menu with 22 items in the main tabs.
I wonder if it is possible to create a second row of main menu tabs, and halve it, so each for has 11 tabs.
Menu:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.fusilladeink.org%2Fmenu.png&hash=eaf5c4b4b6349f3dc3c34cf5c083d8f74a0e7631)
Desired example:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.fusilladeink.org%2Fdesiredmenu.png&hash=d33735f394953ad105a129dbc1bde056e32f0748)
Thanks =)
Now... this is a mod?
Quote from: zx71 on June 18, 2010, 12:18:25 PM
hi all i've been getting these errors in my error log and have no idea how to fix them:
http://domain.com/index.php?action=search2
8: Undefined index: href
File: /var/www/Themes/default/index.template.php
Line: 618
http://domain.com/index.php?action=search2
8: Undefined index: title
File: /var/www/Themes/default/index.template.php
Line: 619
(i also get the above two errors for http://domain.com/index.php?action=register2)
and here's line 618 and 619:
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
<span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
would appreciate any help with this thank you :)
I am not receiving any of these errors, are you still using Curve default theme 2.0RC3?
Quote from: FireDitto on June 26, 2010, 07:06:51 AM
I wonder if perhaps someone could help me please?
I have a menu with 22 items in the main tabs.
I wonder if it is possible to create a second row of main menu tabs, and halve it, so each for has 11 tabs.
Menu:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.fusilladeink.org%2Fmenu.png&hash=eaf5c4b4b6349f3dc3c34cf5c083d8f74a0e7631)
Desired example:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimages.fusilladeink.org%2Fdesiredmenu.png&hash=d33735f394953ad105a129dbc1bde056e32f0748)
Thanks =)
Interesting idea/suggestion, but this isn't what the trick accomplishes. To do this you will need another button array, and call both of them in index.template.php (assuming your css would even show the buttons in the manner you described).
Quote from: lucas-ruroken on July 06, 2010, 06:28:31 PM
Now... this is a mod?
This particular trick is not a mod, a similar trick has been made into a mod by someone, however it does not have the dropdown options mine offers. Feel free to take a look. http://custom.simplemachines.org/mods/index.php?mod=2564
ok perfect ^^
Thanks
Nice tip! Ping for later reading...
greetings,
Is it passable with some parts of this code create dropdown MAIN MENU for CORE theme? maybe just structure without nice style?
This is absolutely fantastic, and should definitely be implemented into SMF!
I was able to add 7 menus (didn't need anymore) to the top. Fantastic. Some of the sub-menus are 12 items long, so the list works great. :)
Only downside: I wasn't able to figure out how to include some of the SSI includes into the sub-menus, but no big.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.krysiasweb.net%2FJTLFF2010%2FJTLFF2010_scrnsht.png&hash=92576ae74e68442befab61855a762fce67951879)
I'm trying to do this but twice I have done the find and replace in dreamweaver and it can't find the lines I've to fix. I'm sure it won't wok if I don't find them all. I just upgrades to 2.0rc3 and everything is going ok (fingers crossed) just trying to mod it and really need a new menu item with drop down for downloads.
It was the last one on the index.template I couldn't find, along with the first subs one. Any ideas why I won't have those lines. I have tiny portal installed if that makes any difference
Quote from: flutter on October 20, 2010, 12:14:45 PM
I'm trying to do this but twice I have done the find and replace in dreamweaver and it can't find the lines I've to fix. I'm sure it won't wok if I don't find them all. I just upgrades to 2.0rc3 and everything is going ok (fingers crossed) just trying to mod it and really need a new menu item with drop down for downloads.
It was the last one on the index.template I couldn't find, along with the first subs one. Any ideas why I won't have those lines. I have tiny portal installed if that makes any difference
Are you using Default Curve theme? Or at least a Curve based theme? If not it probably won't work. Instead of searching for the entire line, try searching for part of the line (just make sure there are no other occurances of what you search for). Tinyportal may replace some of my edits with there own code, in which case you will need to adjest accordingly. But yea, my best guess is searching for part of the line and deciphering what needs to be changed will be your best bet. Let me know how it goes.
well I just got this and from what I could make out the curve theme was the default theme. Tha't what I'm using, though it says core theme.
If I change stuff that tiny portal has done, will it not break the portal, and if I just skip the things that aren't there, won't this just not work? It's hard ot get a forum just how you want it
Thank you for getting back to me
Its hard to say. It won't hurt to try if you make a backup of each file you make changes too. And then if you do run into a problem jut revert back ot the original file.
Really, nice tip ! Thank you... :-*
But somebody have an idea how to make this (main) tabs active ?
Has anyone updated this for RC4?
Del
This still works for me in RC4. Just had to go back and add the edits to subs.php.
Del
How can i make this buttons (for this additional menu in the top right corner) active, when i visit a page ?
(For example look the picture, please)
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg602.imageshack.us%2Fimg602%2F384%2Factivebutton.png&hash=15e573fe1a644547b6a345a25c79b5dc802cb1d1) (http://img602.imageshack.us/i/activebutton.png/)
Uploaded with ImageShack.us (http://imageshack.us)
I didn't build this modification to allow for that, I assume you will need to use some form of the CSS active_button, but in this mods current form, this cannot be accomplished.
I added all of the code without errors, but the menu doesn't show still. I had the SMF logo suppressed from the get go though.
try to echo anything where the menu should go. You could have a style that is setting display:none; possibly. Make sure its not nested between <!-- (menu code) --> HTML tags either, then it will just get ignored.
Quote from: Scope XL on November 21, 2010, 03:28:09 PM
try to echo anything where the menu should go. You could have a style that is setting display:none; possibly. Make sure its not nested between <!-- (menu code) --> HTML tags either, then it will just get ignored.
It works on the regular curve theme but not my modified curve theme (RGBB Curve).
Yea, I only designed it to work with default Curve. No curve variations have been tested. Theoretically if its a true curve variation it should work with minimal differences in the code edits.
colby this should work for your theme post the fukes you edited and we can check the code.
I've made these edits on RC4, but only to the theme I am currently using. It is curve based, but the menu is being aligned on the left side.
Do I need to edit the default template & my current theme?
Also does anyone have a thought about why the menu isn't aligning properly? It was working perfectly before on RC3.
Quote from: Runic on November 23, 2010, 09:53:02 AM
colby this should work for your theme post the fukes you edited and we can check the code.
I had it working to the point at which it was directly under the dashboard carrot ^, no drop-down links were working, and the My Messages didn't show the number of new PMs. I can figure out the last part as that has to do with subs.php, but why didn't the placement nor the drop-down links work?
Quote from: Scrooge on November 23, 2010, 09:53:02 AM
colby this should work for your theme post the fukes you edited and we can check the code.
Fukes?
I was able to get it working for my curve variation. How do I remove the original menu, so that I don't have two menus?
Quote from: colby2152 on December 14, 2010, 02:18:51 PM
I was able to get it working for my curve variation. How do I remove the original menu, so that I don't have two menus?
To clarify.. I am using this mod to move my forum menu up to the very top. I then want to remove the forum menu in addition to the news/search/user-info sections.
Okay, so I have added the navigation menu to the top but one key problem... items like the number of new messages in brackets to the right of Messages do not appear. Likewise, the logout / login-register buttons are not showing.
No feedback?
Is there any way this can be made a mod? This would be an amazing one!
hi i have this installed on my forum and have been suing it for quite some time and i'm now having problems after changing smf's cache settings (apc)
it was on the default '1' but i changed it to '3' but now not matter if i have it set to 1,2 or 3 the menu just won't show
i've tried to clear the cache before and after but the only way i can get the menu to show now is to disable the cache
any ideas?
here's a few of the errors i get with cache set to 1,2 or 3:
error1:
8: Undefined variable: menu_buttonsTop
Apply Filter: Only show the errors from this file
File: /var/www/web8/web/Sources/Subs.php
Line: 4637
line 4637 from Subs.php:
$context['custom_menu_buttons'] = $menu_buttonsTop;
error2:
2: Invalid argument supplied for foreach()
Apply Filter: Only show the errors from this file
File: /var/www/web8/web/Themes/default/index.template.php
Line: 572
line 572 from index.template.php:
foreach ($context['custom_menu_buttons'] as $act => $button)
Quote from: MarcusJ on November 23, 2010, 10:24:04 AM
I've made these edits on RC4, but only to the theme I am currently using. It is curve based, but the menu is being aligned on the left side.
Maybe somebody solved this ?
Quote from: CapadY on June 04, 2011, 11:38:29 AM
Maybe somebody solved this ?
Actually, I did.
#top_section
{
min-height: 65px;
/*overflow: hidden;*/
margin-bottom: 3px;
}
#site_menu
{
padding: 12px 0 4px 1em;
margin: 0;
/*overflow: hidden;*/
font-size: 1.1em;
font-family: tahoma, sans-serif;
float: right;
}
h1.forumtitle
{
font-family: "Century Gothic", tahoma, sans-serif;
position: absolute;
}
#main_menu
{
margin-top: 1em;
}
#site_nav li a.active
{
background: url(../images/theme/menu_gfx.png) no-repeat 100% -31px;
}
#site_nav li a.active span.firstlevel
{
background: url(../images/theme/menu_gfx.png) no-repeat 0 -31px;
}
Great, thank you very much.
No problem! ;)
It was a very simple fix.
How is work on RC5? I am did steps, writed in first message of this topic, but is not work. More errors of them. First on subs.php, second - on index.template.php Anybody know, how it solved for Curve RC5?
Thanks
I got no errors on SMF 2.0 RC5. Wich mods do you have installed?
ResizeImagesToFitScreen 0.1.6
YouTube BBCode 2.6
Board Viewers Mod 1.2.1.1b
SimplePortal 2.3.3
Did you followed all steps carefuly? Wich errors do you get?
Fatal error: Call to undefined function cache_get_data() in /home/virtwww/w_sdvigpolysov-ru_62a2c6b7/http/Sources/Subs.php on line 4388
If i am back up Subs.php, then on my forum the "logo" is moved on personal info (hello user, avatar, etc).
sdvigpolysov.ru is my forum.
So, anybody can help me?
I am re-install all smf2.0 rc5 files without any mods, and setup all steps, and error is still on forum.
Fatal error: Call to undefined function cache_get_data() in /Sources/Subs.php on line 4200
Somebody try to setup this top menu on 2.0? I am dont. Its not worked, its worked with errors.
Fatal error: Call to undefined function cache_get_data() in Sources/Subs.php on line 4337
I think this is wrong code in Subs.php by autor.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
I don't understand why you would be receiving this error. cache_get_data() is a primary function in Sources/Load.php Open that file and make sure it isn't commented out (maybe from another mod?) and then try and see if you receive that error.
Here is the function from SMF Function DB: http://support.simplemachines.org/function_db/index.php?action=view_function;id=76
Let me know if it works for you.
Quote from: steve51184 on June 18, 2010, 12:18:25 PM
hi all i've been getting these errors in my error log and have no idea how to fix them:
http://domain.com/index.php?action=search2
8: Undefined index: href
File: /var/www/Themes/default/index.template.php
Line: 618
http://domain.com/index.php?action=search2
8: Undefined index: title
File: /var/www/Themes/default/index.template.php
Line: 619
(i also get the above two errors for http://domain.com/index.php?action=register2)
and here's line 618 and 619:
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
<span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
would appreciate any help with this thank you :)
Got the same error.
for title
<span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
for href
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
Those errors seem to appear in error log when someone is using the 'search' button/searchbox.