Advertisement:

Author Topic: Add menu button function  (Read 49435 times)

Offline lurkalot

  • Sr. Member
  • ****
  • Posts: 978
  • Gender: Male
  • Tinyportal Support
    • guitaristguild on Facebook
    • Tinyportal on GitHub
    • @GuitaristGuild on Twitter
    • Guitarist Guild
Add menu button function
« on: April 29, 2010, 01:01:47 PM »
One of the most asked questions on the forums seems to be, how do I add a button / tab to my menu.

It would be great if the functions off the two mods linked below were actually built into SMF 2.  I'm using both these mods on my RC3 install and it's so, so easy to add new buttons.   8)

Custom site menu

Menu order

Anyone else with me on this?
« Last Edit: November 20, 2010, 01:58:34 AM by Norv »

Offline Ozzie

  • Full Member
  • ***
  • Posts: 411
  • Gender: Male
    • ozzie's place
Re: Add menu button function
« Reply #1 on: April 29, 2010, 01:05:56 PM »
umm i wonder where u got that idea from  ;D ;D u know im with u on this

2000+ games available to download

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #2 on: April 29, 2010, 01:06:33 PM »
I agree, menu customisation would be good to build in.

At the same time you need to be moderately careful about doing it because modders can and do add interesting things into the menu bar; for example in SimpleDesk we dynamically add a number to the Helpdesk menu item, to represent the number of tickets that are open and that you probably need to look at.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Ozzie

  • Full Member
  • ***
  • Posts: 411
  • Gender: Male
    • ozzie's place
Re: Add menu button function
« Reply #3 on: April 29, 2010, 01:11:54 PM »
These two mods individually are great i recommend them all the time to people it would be nice also to have one single mod which combines the functions of both as they work well together

2000+ games available to download

Offline lurkalot

  • Sr. Member
  • ****
  • Posts: 978
  • Gender: Male
  • Tinyportal Support
    • guitaristguild on Facebook
    • Tinyportal on GitHub
    • @GuitaristGuild on Twitter
    • Guitarist Guild
Re: Add menu button function
« Reply #4 on: April 29, 2010, 01:16:46 PM »
umm i wonder where u got that idea from  ;D ;D u know im with u on this

Yep, thanks OZZIE for pointing those mods out to me. So nice not to have to mess about editing files just add a button. ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #5 on: April 29, 2010, 01:19:19 PM »
What we really need is full blown menu manager, not just reordering things but full on management, really, also capable of dealing with custom items that aren't just simple tabs.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Ozzie

  • Full Member
  • ***
  • Posts: 411
  • Gender: Male
    • ozzie's place
Re: Add menu button function
« Reply #6 on: April 29, 2010, 01:26:10 PM »
I totally agree Arantor maybe if enough people agree with this and respond to this thread  maybe it could be taken into consideration for the next release im sure everyone likes anything that makes life easy and this sure would

2000+ games available to download

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #7 on: April 29, 2010, 01:29:28 PM »
Well, when I was still on the team there was a discussion about what should be in 2.1 - and though that was months ago I don't believe this was on the list.

I know a really powerful mod was in development though.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Ozzie

  • Full Member
  • ***
  • Posts: 411
  • Gender: Male
    • ozzie's place
Re: Add menu button function
« Reply #8 on: April 29, 2010, 01:32:49 PM »
Well, when I was still on the team there was a discussion about what should be in 2.1 - and though that was months ago I don't believe this was on the list.

I know a really powerful mod was in development though.


 ;D stop teasing we will all be on tenterhooks now trying to guess what this wonderful new mod may be

2000+ games available to download

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #9 on: April 29, 2010, 01:35:38 PM »
It's a menu management mod, that lets you rearrange the menu, add new items, assign permissions to view stuff. I don't know if it ever got finished though.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline jani01

  • Jr. Member
  • **
  • Posts: 100
    • Pakistan Biggest MP3 songs Portal
Re: Add menu button function
« Reply #10 on: May 11, 2010, 06:04:41 AM »
It's a menu management mod, that lets you rearrange the menu, add new items, assign permissions to view stuff. I don't know if it ever got finished though.

when this mod will be available ?


Offline NanoSector

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 10,471
  • Gender: Male
  • VC321xb47@aperture:~#
    • Yoshi2889 on GitHub
Re: Add menu button function
« Reply #11 on: May 13, 2010, 02:22:05 PM »
There is one mod that allows you to add one tab that is actually a link...I use it :)

http://custom.simplemachines.org/mods/index.php?mod=1402
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #12 on: May 13, 2010, 02:22:30 PM »
when this mod will be available ?

When the author finishes it?
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline NanoSector

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 10,471
  • Gender: Male
  • VC321xb47@aperture:~#
    • Yoshi2889 on GitHub
Re: Add menu button function
« Reply #13 on: May 13, 2010, 02:54:47 PM »
By the way, SMF For Free has a system that allows you to create as many tabs as you want...with URL redirection...

http://www.smfforfree.com/
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: Add menu button function
« Reply #14 on: May 16, 2010, 11:25:40 PM »
I don't see why the menu system was moved from the templates to the sources. Didn't solve a thing, bad idea IMHO.

I just don't get it, should of been in the DB and cached.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #15 on: May 17, 2010, 03:20:12 AM »
Actually it solved one MASSIVE problem.

Look through the support boards for mods that add menu items to themes and see how often you have to do a theme edit by hand. For 1.1, EVERY SINGLE MOD that adds a custom button to a theme has to be done by hand. Without fail. Every time.

With 2.0, this pain is (virtually) gone because you add the button once in a single consistent place and invariably it's just done. There's still a few themes that hardcode the button list into the template but the vast majority don't, meaning that for a modder it's a ton simpler to add a menu item.

* Arantor speaks from bitter experience on this.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline lurkalot

  • Sr. Member
  • ****
  • Posts: 978
  • Gender: Male
  • Tinyportal Support
    • guitaristguild on Facebook
    • Tinyportal on GitHub
    • @GuitaristGuild on Twitter
    • Guitarist Guild
Re: Add menu button function
« Reply #16 on: November 12, 2010, 03:25:35 AM »
Any further thoughts on this idea?   :(

Offline Norv

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 18,313
  • Blue Wolf
Re: Add menu button function
« Reply #17 on: November 12, 2010, 05:54:55 AM »
Does this suit the purpose?
http://custom.simplemachines.org/mods/index.php?mod=331

I believe that a more featured menu editor would be a very welcome addition as a (potentially official) mod. I'm not so sure about core integration. If it is useful enough, popular and considered suitable for core, it might (or not) be taken into account as optional feature too, in the future versions.
To-do lists are for deferral. The more things you write down the later they're doneā€¦ until you have 100s of lists of things you don't do.
File a security report | Developers' Blog | Bug Tracker

Also known as Norv on D* | Norv N. on G+ | Norv on Github

Offline JohnWayne999

  • Semi-Newbie
  • *
  • Posts: 90
    • AutoAward
Re: Add menu button function
« Reply #18 on: October 13, 2011, 05:23:51 PM »
Thanks for the links. I found a few other ones here:

"Adk Menu Buttons 1.0" (http://custom.simplemachines.org/mods/index.php?mod=3075) is compatible with SMF 2.0.1 but caution it failed at least these themes: WhiteBlacklbz, Totalblue, Prored, Optic, Inno, Everdream, Elegant, Astonished, 2011.
Note also this mod doesn't let you add button to the native menu of "Help", "Logout" etc. It adds a new panel of buttons just below innate menu.

"6 Custom buttons / tabs and menu's (upto 4)" gives you collapsable menus up the very top. http://custom.simplemachines.org/mods/index.php?mod=2657

"Custom Site Menu" is something similar. I think this one lets you add button to the innate menu (ie. adds additional buttons to "Help", "Logout" etc). http://custom.simplemachines.org/mods/index.php?mod=2259

"Menu Order" then lets you rearrange the order the innate menu buttons (eg. "Help", "Logout" buttons). http://custom.simplemachines.org/mods/index.php?mod=2348


By the way, does anyone know how to make their button open up into a new window? For example only one of my buttons is "Chatroom". I would like that button when pressed, to open a separate new window which runs Chatroom. How do I establish that? Now the buttons and menus are getting very complicated in SMF 2.x, I'm not sure if I want to go in and edit things manually, worried down the track it might interfere with other things. Is there a simpler solution? Thanks.

Offline timetraveller

  • Jr. Member
  • **
  • Posts: 221
Re: Add menu button function
« Reply #19 on: October 17, 2011, 05:20:10 AM »
Are any of the mods listed here suitable for SMF 2.0.1?

All I'm looking for is to add one button in exactly the same style as existing menu so I can link back to the home page and to rename the current "home" button to "forum".

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Add menu button function
« Reply #20 on: October 18, 2011, 11:30:16 AM »
Are any of the mods listed here suitable for SMF 2.0.1?

All I'm looking for is to add one button in exactly the same style as existing menu so I can link back to the home page and to rename the current "home" button to "forum".

You don't need a mod to do that. A quick edit to Subs.php will do the trick:

Find
Code: [Select]
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),

Replace
Code: [Select]
'home' => array(
'title' => $txt['home'],
'href' => 'http://www.yoursite.com',
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'forum' => array(
'title' => 'Forum',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),

Or, if you want the "Home" item to open in a new window, you can do this (it's a bit of a cheat, but it works well):
Code: [Select]
'home' => array(
'title' => $txt['home'],
'href' => 'http://www.yoursite.com" target="_blank"',
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'forum' => array(
'title' => 'Forum',
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Add menu button function
« Reply #21 on: October 18, 2011, 11:39:29 AM »
Oldies - A better way to add a target is like this...
Code: [Select]
'target' => '_blank',As "target" is already a variable built into the Menu system.

Also, I should be releasing a Menu Editor Lite system for SMF 2.0.1 around Christmas time :)

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Add menu button function
« Reply #22 on: October 18, 2011, 11:43:11 AM »
Oldies - A better way to add a target is like this...
Code: [Select]
'target' => '_blank',As "target" is already a variable built into the Menu system.

Also, I should be releasing a Menu Editor Lite system for SMF 2.0.1 around Christmas time :)

Didn't know that. I've always seen it done the "sneaky" way that I pointed out above.
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Add menu button function
« Reply #23 on: October 18, 2011, 11:46:35 AM »
index.template.php
Code: [Select]
<a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>

Offline timetraveller

  • Jr. Member
  • **
  • Posts: 221
Re: Add menu button function
« Reply #24 on: October 19, 2011, 06:45:37 PM »
Ooh - some coding ..... am I ready to take the plunge??? It looks straightforward .....  :-\

Offline timetraveller

  • Jr. Member
  • **
  • Posts: 221
Re: Add menu button function
« Reply #25 on: October 20, 2011, 04:47:03 PM »
First problem - can't find that bit of code.

Found two files in "Sources" directory. One labelled subs.php  and the other subs.php~

I assume I need subs.php but when I pasted that first bit of code into the search box on TextPad it can't find it.

I'm using SMF 2.0.1 with a colour variant of Curve theme.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Add menu button function
« Reply #26 on: October 20, 2011, 04:48:51 PM »
You should open up a new topic for your question in SMF Coding Discussion.

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Add menu button function
« Reply #27 on: December 05, 2011, 05:10:11 PM »
Would be useful standalone and ... only a few portals have menu functions as well.

Language Menu
One thing I think should be added automatically to the menu is a language button with submenu items for each added language.
Cant believe how messy it is adding mod code all the time in different themes to get either a language button, drop down or flag. No other software is this bad ... that put me off SMF 5 years ago and it hasn't improved much.

Languages are automatically added in admin so why can't a menu items for them (in a list under languages). When a new (first) language is added a language menu button should be added with that language as a submenu item. Additional added languages being added to the language menu list.




Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,119
  • Gender: Male
    • Kindred-999 on GitHub
Re: Add menu button function
« Reply #28 on: December 05, 2011, 09:30:33 PM »
Language does not belong in the main menu.....
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Add menu button function
« Reply #29 on: December 05, 2011, 09:38:05 PM »
Kindred is right...and it wouldn't be hard to add yourself. $context['languages'] is populated by getLanguages();, call getLanguages(); in the setupMenuContext(); function, and then use a loop to feed the languages into the menu array where you want.

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Add menu button function
« Reply #30 on: December 06, 2011, 02:08:24 AM »
Thats the only place that I can think of it working on any template as it is the only thing uniformly displayed on all templates. If there is no other way except editing by hand then it is, as I said - a mess. Other CMS and boards manage it much better I think.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 55,119
  • Gender: Male
    • Kindred-999 on GitHub
Re: Add menu button function
« Reply #31 on: December 06, 2011, 09:58:19 AM »
There are plenty of better places for it.... and several different ways to get it into those locations.
Language choice does not belong in the main menu.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,430
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Add menu button function
« Reply #32 on: December 06, 2011, 10:17:43 AM »
Eventually I'll get to updating my Language Dropdown mod, which won't have any template edits. Let's get back on topic here, though.

Offline OCJ

  • Full Member
  • ***
  • Posts: 481
  • Gender: Male
Re: Add menu button function
« Reply #33 on: December 06, 2011, 10:30:18 AM »
This is the point, if it cant go in the menu it should have some universal positions - or placement like Joomla with a mod position all themes should follow.... haha - fat chance of that.

It should be sorted out some way or other as it puts off ordinary people using smf when they have to place a function call in a template file they know nothing about.
"oh wait a minute what about that semi colon or echo and apostrophe" ...

Even for reasonably savvy people it doesn't work out all the time - shouldn't be that way these days and its holding back smf from what it should be.


utf8  has taken over recently and for good reason - we all need extra languages as we cross borders and languages to share information.

Offline lurkalot

  • Sr. Member
  • ****
  • Posts: 978
  • Gender: Male
  • Tinyportal Support
    • guitaristguild on Facebook
    • Tinyportal on GitHub
    • @GuitaristGuild on Twitter
    • Guitarist Guild
Re: Add menu button function
« Reply #34 on: November 07, 2013, 04:11:52 PM »
Did the menu manager idea ever get considered as a core feature?  Yes I know it's an old thread, but it's still a relevant question. ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,050
    • Arantor on GitHub
Re: Add menu button function
« Reply #35 on: November 07, 2013, 04:15:47 PM »
It got considered, it certainly isn't going to happen in 2.1. Will it happen for 3.0? Probably, but no-one can say for certain right now.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline lurkalot

  • Sr. Member
  • ****
  • Posts: 978
  • Gender: Male
  • Tinyportal Support
    • guitaristguild on Facebook
    • Tinyportal on GitHub
    • @GuitaristGuild on Twitter
    • Guitarist Guild
Re: Add menu button function
« Reply #36 on: November 07, 2013, 04:20:33 PM »
It got considered, it certainly isn't going to happen in 2.1. Will it happen for 3.0? Probably, but no-one can say for certain right now.

Thanks, I'm more than happy with that answer.  It might not seem like it, but I can guarantee people would love that feature. :)