News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Menu without limit level

Started by davidhs, March 08, 2010, 03:47:03 PM

Previous topic - Next topic

davidhs

Quote from: Denis Pageau on August 09, 2015, 09:37:03 AM
Quotehis mod only install in default theme of SMF 2.0.x series.

This is what I did, but I did receive the message and event when installed, it did not work, or at least I could not find the place to create the menu ( I used your MOD about a year ago and it worked. I am now ready to use it and for some reason it does want to show me where to change it.

Maybe I will try to do it manually.
This mod have not setting area, you must add your multi-level menu manually. In first post of this topic I write an example (use integration hooks).

DenDen60

Using, 2.0.10

Ok, so I installed the Mod.

Now if I understood the instruction well, all I have to do is go into the Subs.PHP, and under the setupMenuContext() add the code.

If I past the code just after setupMenuContext();

Parse error:  syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /home/citize47/public_html/tinc.ca/INT-AFRIQUE/Sources/Subs.php on line 3285

If I paste inside the parenthesis, I still get the same message but for line 3284.

___

If I use the integration hooks options, I get this error message. :-(


Parse error:  syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /home/citize47/public_html/tinc.ca/INT-AFRIQUE/Sources/Subs-MenuMultiLevel.php on line 15


___

Thanks for your help.







davidhs

Quote from: Denis Pageau on August 17, 2015, 10:27:06 AM
If I use the integration hooks options, I get this error message. :-(


Parse error:  syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /home/citize47/public_html/tinc.ca/INT-AFRIQUE/Sources/Subs-MenuMultiLevel.php on line 15
Sorry, there was a typo in this file. I corrected now. Use integration hooks, is more simple.

DenDen60

Ok. I have created this file.

Subs-MenuMultiLevel.php with the code presented.

I have edited the load.php file as presented as well.

(I have tried 2 versions, the one below and another where I added the

   add_integration_function('integrate_menu_buttons', 'menu_multi_level', false);
   add_integration_function('integrate_pre_include', '$boarddir/Sources/Subs-MenuMultiLevel.php', false);


after the '}"

And this one.

    // Integration is cool.
    if (defined('SMF_INTEGRATION_SETTINGS'))
    {
        $integration_settings = unserialize(SMF_INTEGRATION_SETTINGS);
        foreach ($integration_settings as $hook => $function)
            add_integration_function($hook, $function, false);
   
        add_integration_function('integrate_menu_buttons', 'menu_multi_level', false);
    add_integration_function('integrate_pre_include', '$boarddir/Sources/Subs-MenuMultiLevel.php', false);
}



In both cases, I still don't see the extra button. I must be doing something wrong. :-(

Using 2.0.09, default SMF theme.

DenDen60

I have check the files listed here and they all contain the codes. So the mode did install the codes. However, I still don't see the button. What am I doing wrong?

davidhs

Quote from: Denis Pageau on August 18, 2015, 07:13:46 PM
Ok. I have created this file.

Subs-MenuMultiLevel.php with the code presented.

I have edited the load.php file as presented as well.

(I have tried 2 versions, the one below and another where I added the

   add_integration_function('integrate_menu_buttons', 'menu_multi_level', false);
   add_integration_function('integrate_pre_include', '$boarddir/Sources/Subs-MenuMultiLevel.php', false);


after the '}"

And this one.

    // Integration is cool.
    if (defined('SMF_INTEGRATION_SETTINGS'))
    {
        $integration_settings = unserialize(SMF_INTEGRATION_SETTINGS);
        foreach ($integration_settings as $hook => $function)
            add_integration_function($hook, $function, false);
   
        add_integration_function('integrate_menu_buttons', 'menu_multi_level', false);
    add_integration_function('integrate_pre_include', '$boarddir/Sources/Subs-MenuMultiLevel.php', false);
}



In both cases, I still don't see the extra button. I must be doing something wrong. :-(

Using 2.0.09, default SMF theme.
Quote from: Denis Pageau on August 19, 2015, 09:04:21 AM
I have check the files listed here and they all contain the codes. So the mode did install the codes. However, I still don't see the button. What am I doing wrong?
I do not see the mistake :( Please, attach here your files
- Sources/Subs.php (perhaps you edited this and has a typo)
- Sources/Load.php
- Sources/Subs-MenuMultiLevel.php
and I will revise.

DenDen60

#86
Here you go.

Thanks

davidhs

Quote from: Denis Pageau on August 20, 2015, 08:34:16 AM
Here you go.

Thanks
I do not see mistake in your files... except... in SMF original files use {db_prefix} in table names, i.e. {db_prefix}members, and your files use "membership_", i.e. membership_members. Perhaps one of your installed mods changes this.

I attach my Subs-MenuMultiLevel.php file. Test this.

DenDen60

OK I will check this out and let you know.

Thanks
Denis




davidhs

Compatible with SMF 2.0.14 and 2.0.15.

davidhs

New version:
2.0     2017-12-20
------------------
@ In previous versions manual changes were necessary in the Sources/Load.php file. They are no longer necessary and must be undone.
@ In previous versions the PHP file where the menu is modified could have any name. Now it must be named Subs-MenuWithoutLimitLevel-Menu.php. If it exists with another name it must be renamed. And the function must be named mwllMenuButtons.
* Utiliza integration hooks.
+ SMF compatibility: 2.0.8-2.0.15 and 2.1 Beta 3.

davidhs

New version:
2.0.1   2019-04-09
------------------
+ SMF compatibility: 2.1 RC1 to RC2.

davidhs

Compatible with SMF 2.0.16 and 2.0.17.

davidhs

New version:
3.0     2021-02-17
------------------
@ In previous versions the menu was modified in a file (named Subs-MenuWithoutLimitLevel-Menu.php from version 2.0, and with any name in previous versions). Now the menu is modified from the Administration panel. You must copy the content of the file in the field of panel, and delete the file.
+ Administration panel.
+ Allows changing the menu structure in the Administration panel, using PHP code.
+ The Quick Search of the Administration Center look for in settings variables of MOD.
+ SMF compatibility: 2.0.16-2.0.18 and 2.1 RC3.
+ Languages: english, english-utf8, english_british, english_british-utf8, spanish_es, spanish_es-utf8, spanish_latin, spanish_latin-utf8.

davidhs

The large text field of the Administration panel where to write the PHP code, in SMF 2.0.x series it is too narrow, and in SMF 2.1.x series is too wide.

To fix this, I will add a code in next update, when there is an important change. At this moment you can do it yourself, it will not prevent you uninstalling the mod later. The file Sources/Admin-MenuWithoutLimitLevel.php must be modified.

For 2.0.x series:
Code (Add in line 51) Select
$context['html_headers'] .= '
<style type="text/css">
textarea#mwll_code { width: 90%; }
</style>';

For 2.1 Beta x series:
Code (Add in line 57) Select
addInlineCss('
textarea#mwll_code { width: 90%; }');

For 2.1 RCx series:
Code (Add in line 64) Select
addInlineCss('
textarea#mwll_code { width: 90%; }');

Grammy

2.1RC3, default

Where in these files is the bit that causes the helptopics.png icon to appear next to the menu button?  I'd like to get rid of that bit, please.   :)

(attached)

davidhs

Quote from: Grammy on June 05, 2021, 02:24:35 PM
2.1RC3, default

Where in these files is the bit that causes the helptopics.png icon to appear next to the menu button?  I'd like to get rid of that bit, please.   :)

(attached)
SMF 2.1 adds icons to all menu items of level 1. But you can change the default icon.

You can add an 'icon' key in PHP code (see my example in the first post):
$buttons2 = $buttons;
$buttons = array();
foreach ($buttons2 as $i => $b)
{
$buttons[$i] = $b;
if ('home' == $i)
{
$buttons['m0'] = array(
'title' => 'Menu multi-level',
'href' => '',
'icon' => 'icq.png',
'show' => true,
'sub_buttons' => array(
[...]

This code adds the icon icq.png to menu item. The icon must be in folder: YOUR_FORUM/Themes/DEFAULT_OR_YOUR_THEME/images/

Advertisement: