Creating buttons with submenus and more submenus

Started by MyTime, November 05, 2014, 05:01:21 PM

Previous topic - Next topic

MyTime

I found this code on http://wiki.simplemachines.org/smf/Buttons_-_How_do_I_add_buttons_to_SMF_2.0#forum

'menu_action' => array(
            'title' => 'text for menu',
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
               'sub_menu_action' => array(
                  'title' => 'text for sub-menu',
                  'href' => $scripturl . '?action=newaction',
                  'show' => true,
                  'is_last'=> true,
               ),
            ),
         ),

But I can't figure out how too add more submenu buttons, i have tried a couple versions on my own by copy and pasting some of the code but it either breaks the forum or doesn't seem too do anything.

I have portamx downloaded and removed the community tab, so I can add my own community tab with submenu's, but i'd also like too have another submenu ontop of a submenu if that makes sense. for example,
Community>
ps3>submenu Ps3 games > sub-submenu Ps3 blog
ps4>submenu ps4 games > sub-submenu Ps4 blog

Thanks for any help i'v been struggling on this for a while now

Branko.

Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

MyTime

#2
The mod isn't working on my forums. Getting a lot of errors I have a custom theme.

Or maybe assist me in the code too add another drop down button, and than too create sub buttons, sorry i'v been really trying too get my site up and the button mod didn't work.

Pipke

in subs.php around line 3327 you can edit the help menu with submenu and another submenu like this


            'help' => array(
                'title' => $txt['help'],
                'href' => $scripturl . '?action=help',
                'show' => true,
                'sub_buttons' => array(
                    'help1' => array(
                    'title' => $txt['help'],
                    'href' => $scripturl . '?action=help1',
                    'show' => true,
                    ),
                    'help2' => array(
                    'title' => $txt['help'],
                    'href' => $scripturl . '?action=help2',
                    'show' => true,
                        'sub_buttons' => array(
                            'help2A' => array(
                            'title' => $txt['help'],
                            'href' => $scripturl . '?action=help2A',
                            'show' => true,
                            ),
                            'help2B' => array(
                            'title' => $txt['help'],
                            'href' => $scripturl . '?action=help2B',
                            'show' => true,
                            ),
                        ),
                    ),
                    'help3' => array(
                        'title' => $txt['help'],
                        'href' => $scripturl . '?action=help3',
                        'show' => true,
                    ),
                    'help4' => array(
                        'title' => $txt['help'],
                        'href' => $scripturl . '?action=help4',
                        'show' => true,
                        'is_last' => true,
                    ),
                ),
            ),


then you will get the idea.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

MyTime

The picture I attatched it was it looked like after I added in that code, any suggestions or pointers? Thanks for your guy's time

MyTime

These did not work very well for me, any more suggestions?

MyTime

pipke, The code I tried from you breaks the forums. Do you have any tips?

kat


Pipke

Quote from: CannabisGamerClub on November 17, 2014, 12:58:32 AM
pipke, The code I tried from you breaks the forums. Do you have any tips?

Attach your subs.php, and i will implent ONE extra menu for ya, like the 'help' i did. Then take a close look what i did, then try it out yourself with another menu. This way you learn how to setup (more) menu's in the menu. PS. I implent hardcoded txt strings,but that comes later.....how to fix that.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Kindred

well...   if you want to do sub-sub-sub menus, then you are going to need to add CSS to handle it as well...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

MyTime

I got the files edited for me too add sub menus and drop downs menus, but i'm having trouble adding multiple buttons now.

Siirist

#11
Hello,

Bringing this back to life (I hope).

I have modified my subs.php to accommodate changes to the Menu and sub-menu.   :P

All my "links" function, and the images from Menu Icons MOD also appear,   ;)
HOWEVER, the text does not appear.  :-\
It seems like there is some sort of code that allows ONLY certain text to be used.

Examples: Line A) appears   Line B) does not appear
A) .$txt['forumprofile']. '"/>&nbsp; ' . $txt['forumprofile'],                         <!--Appears as Forum Profile-->
B) .$txt['groupmembership']. '"/>&nbsp; ' . $txt['groupmembership'],       <!--Nothing appears-->


   <!--This appears as Forum Maintenance-->
'sub_buttons' => array(
'maintain' => array(
'title' => '<img align="absMiddle" src="'. $settings['images_url']. '/menu_icons/downloads.png" alt="'.$txt['maintain_title']. '"/>&nbsp; ' . $txt['maintain_title'],
'href' => $scripturl . '?action=admin;area=maintain',
'show' => allowedTo('admin_forum'),
),
   <!--This appears as Boards ~ ONLY WHEN I AM IN ACP-->
'manageboards' => array(
'title' => '<img align="absMiddle" src="'. $settings['images_url']. '/menu_icons/boards.png" alt="'.$txt['admin_boards']. '"/>&nbsp; ' . $txt['admin_boards'],
'href' => $scripturl . '?action=admin;area=manageboards',
'show' => allowedTo('manage_boards'),
),
  <!--Nothing appears for this-->
'gallery' => array(
'title' => '<img align="absMiddle" src="'. $settings['images_url']. '/menu_icons/gallery.png" alt="'.$txt['gallery']. '"/>&nbsp; ' . $txt['gallery'],
'href' => $scripturl . '?action=admin;area=gallery',
'show' => allowedTo('admin_forum'),
),
  <!--This appears as Error Log ~ ONLY WHEN I AM IN ACP-->
'errorlog' => array(
'title' => '<img align="absMiddle" src="'. $settings['images_url']. '/menu_icons/errorlog.png" alt="'.$txt['errlog']. '"/>&nbsp; ' . $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
'is_last' => true,


I have attached the Subs.php

I am using SMF ver 2.0.11

I have the following Themes:
Core,
Default,
Fresh Look
Fumes,
Havvo,

I have the following MODs:
1.    Menu_Icons
2.    SMF Gallery Lite
3.    SMF 2.0.11 Update
4.    Board-color-and-icons

Here's a link to Your Sanctuary
//EDIT:
UserName=Sample
Password=showme
(Gallery is not visible ~ may be that I have to adjust permissions)
You will see the failures on Gallery which is view-able by Guests

Thanks for looking and for your guidance.

Be Well,
Siirist
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Kindred

Are those new text strings defined in either index.english.php or modifications.english.php?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

Quote from: Kindred on January 25, 2016, 11:19:44 PM
Are those new text strings defined in either index.english.php or modifications.english.php?

Hi Kindred,

Thanks for your help.

That would be negative.

Also I edited my post because nothing was viewable as a Guest, so I created a limited account so you can see.

Siirist
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

Kindred

Well. That would be the problem then...  If you use $txt variables, you have to define what the values of those variables are going to be...  How else would the system know that you want it to display the text "my awesome sauce" when you tell it to display $txt['blahblah']
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Siirist

Quote from: Kindred on January 26, 2016, 12:23:31 AM
Well. That would be the problem then...  If you use $txt variables, you have to define what the values of those variables are going to be...  How else would the system know that you want it to display the text "my awesome sauce" when you tell it to display $txt['blahblah']

WOO HOO, I know how to write .php files now!!!  NOT. Just joking.

Anyway, I added the "strings" to the index.english.php (which was in the Themes/default, but not it Fresh Look, Fumes, or Havvo) and everything appears to be functioning as desired.
Do I need to add those "strings" to the modifications.english.php as well?

Also, my Gallery icon is 16x16, however it looks like this .   :(
Thoughts?

Thank for your guidance.

Sincerely,
Siirist
Needed information:
- What's your SMF version?, What MODs are installed? What Theme(s) are you using? Have you backed up your database?

--> At least 50% of the questions asked are answered in the Online Manual <--
Mods for ver 1.x will NOT run on ver 2.x

margarett

No, you don't need those strings in any other language file ;)
About the icons issue, please start a new topic as that issue is unrelated and the topic is already marked as solved by the original author)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Kindred

well, index.english.php is fine... but modifications.english.php is actually the recommended location for new strings --- just to keep things organized between original strings and added strings. :)

the other question was answered by margarett :D
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: