Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: davidhs on March 08, 2010, 03:47:03 PM

Title: Menu without limit level
Post by: davidhs on March 08, 2010, 03:47:03 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=2454)

Menu without limit level

ABOUT...

Menu without limit level, 3.0
© 2010-2021 by davidhs

(https://creativecommons.org/licenses/by/3.0/)
This work is licensed under a Creative Commons Attribution 3.0 Unported License (https://creativecommons.org/licenses/by/3.0/).

DESCRIPTION

Adds the possibility that the top menu of the forum has any number of levels.

Modifies:

Also allows changing the menu structure in the Administration panel, using PHP code.

EXAMPLE

To create this menu,
QuoteMenu multi-level

  • Submenu 1 - level 1

    • Submenu 1.1 - level 2

      • Submenu 1.1.1 - level 3
      • Submenu 1.1.2 - level 3
    • Submenu 1.2 - level 2

      • Submenu 1.2.1 - level 3
      • Submenu 1.2.2 - level 3
    • Submenu 1.3 - level 2
  • Submenu 2 - level 1

    • Submenu 2.1 - level 2
    • Submenu 2.1 - level 2

the PHP code is this:
$buttons2 = $buttons;
$buttons = array();
foreach ($buttons2 as $i => $b)
{
$buttons[$i] = $b;
if ('home' == $i)
{
$buttons['m0'] = array(
'title' => 'Menu multi-level',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1' => array(
'title' => 'Submenu 1 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm11' => array(
'title' => 'Submenu 1.1 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm111' => array(
'title' => 'Submenu 1.1.1 - level 3',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1111' => array(
'title' => 'Submenu 1.1.1.1 - level 4',
'href' => '',
'show' => true,
),
'm1112' => array(
'title' => 'Submenu 1.1.1.2 - level 4',
'href' => '',
'show' => true,
),
),
),
'm112' => array(
'title' => 'Submenu 1.1.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm12' => array(
'title' => 'Submenu 1.2 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm121' => array(
'title' => 'Submenu 1.2.1 - level 3',
'href' => '',
'show' => true,
),
'm122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),

'm2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'm22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),

),
);

}
}


SMF COMPATIBILITY


LANGUAGES


DOWNLOAD

Link to MOD (https://custom.simplemachines.org/mods/index.php?mod=2454)

MANUAL INSTALLATION

See https://wiki.simplemachines.org/smf/Manual_installation_of_mods

COLLABORATE WITH THIS MOD

This work is licensed under a Creative Commons Attribution 3.0 Unported License (https://creativecommons.org/licenses/by/3.0/).

You are free to share and adapt this MOD. Also you can collaborate in different ways:

CHANGE LOG

Legend:   ! Fixed   + Added   - Removed   * Changed   @ Note

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.

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

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.
* Uses integration hooks.
+ SMF compatibility: 2.0.8-2.0.15 and 2.1 Beta 3.

1.0.11  2014-01-24
------------------
! Error in source code.
+ SMF compatibility: 2.0.7.

1.0.10  2013-10-24
------------------
+ SMF compatibility: 2.0.6.

1.0.9   2013-08-18
------------------
@ This work is licensed under a Creative Commons Attribution 3.0 Unported License https://creativecommons.org/licenses/by/3.0/
+ SMF compatibility: 2.0.5.

1.0.8   2013-04-09
------------------
+ SMF compatibility: 2.0.4.
- SMF compatibility: Support to RC versions.

1.0.7   2012-12-22
------------------
+ SMF compatibility: 2.0.3.

1.0.6   2011-12-24
------------------
! Some modifications of index.css of theme are not neccesary.
+ SMF compatibility: 2.0.2.

1.0.5   2011-09-20
------------------
+ SMF compatibility: 2.0.1.

1.0.4   2011-06-18
------------------
+ SMF compatibility: 2.0.

1.0.3   2011-02-13
------------------
+ SMF compatibility: 2.0 RC5.

1.0.2   2010-11-04
------------------
+ SMF compatibility: 2.0 RC4.

1.0.1   2010-03-10
------------------
! In 2.0 RC2, levels 4 and more show and hide at a time.
+ SMF compatibility: 2.0 RC3.

1.0     2010-03-08
------------------
+ SMF compatibility: 2.0 RC2.
+ Themes: default.
Title: Re: MenuWithoutLimitLevel
Post by: Sabre™ on March 08, 2010, 10:44:35 PM
Nice mod :)
Something's up on the mod page with the parse/download section.
I cannot choose to parse the mod.
Title: Re: MenuWithoutLimitLevel
Post by: davidhs on March 09, 2010, 06:21:50 AM
As I feel the same, I do not know of that will. Last night I got an update and they may have to revise it.
Title: Re: MenuWithoutLimitLevel
Post by: Sabre™ on March 09, 2010, 10:43:59 AM
Yes, it is a slight mishap that the team or whoever has contact with that side can fix.
Title: Re: MenuWithoutLimitLevel
Post by: Kreator on March 10, 2010, 11:20:19 AM
Hmm, can someone explain what this actually does? I dloaded it , installed ok but nothing happens.

Must I change css or something?
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: davidhs on March 10, 2010, 01:22:46 PM
Only works with default theme.
Quote from: davidhs on March 08, 2010, 03:47:03 PM
Modifies:

  • Code which defines the menu to allow any number of levels.
  • Default theme to show up to 10 levels (main menu and 9 levels of submenus) because of CSS.

Add support for SMF 2.0 RC3.
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: KensonPlays on March 10, 2010, 02:05:02 PM
I can't find admin menu area!
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: davidhs on March 11, 2010, 06:29:05 AM
This MOD does not create an admin menu area, only allow the menu to display more levels in the default theme. The menu is modify as usual in Sources/Subs.php, function setupMenuContext()

For what you say I think there are other MODs.
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: KensonPlays on March 11, 2010, 10:17:38 AM
Yes, like Tyrssons' mod, but limit of five, and no sub-sub-drop downs and the like :(
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: Kreator on March 11, 2010, 10:19:13 AM
I`m using default theme, perhaps some help on how to use this might not go amiss?
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: KensonPlays on March 11, 2010, 10:23:46 AM
So this won't work on ANY other theme? No way at all possible?
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: Arantor on March 11, 2010, 10:47:12 AM
It could be made to work on other themes without so much effort though.

Firstly, move the custom CSS into its own file, and get the installer to install that to $themes_dir/default/menu.css

Then add a line to the source (probably Load.php or index.php, I forget exactly where) to add an entry to $context['html_headers'] to call for that CSS file with a suitable <link> item.

The theme edits look like they'd apply to any of the Curve based themes without much effort through the package manager's own methods for installing on other themes.
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: KensonPlays on March 11, 2010, 10:50:22 AM
Yes, I have like 5-6 curve variations, they said they installed successfully. But for themes like raven and "blue theem V2" didn't
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: Arantor on March 11, 2010, 10:51:11 AM
Yeah, that's because they're not using standard Curve code, which is directly related to what I said above.
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: KensonPlays on March 11, 2010, 10:54:16 AM
ah...
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: davidhs on March 12, 2010, 12:17:49 PM
I put in the first post an example code to add a menu.
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: KensonPlays on March 12, 2010, 02:15:13 PM
thanks!
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: Sakae on March 14, 2010, 08:22:32 PM
Very nice and useful in my forum (check it the info icon on the menu).

How do I hide the "..."?
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: davidhs on March 15, 2010, 08:38:50 AM
Quote from: Sakae on March 14, 2010, 08:22:32 PM
How do I hide the "..."?

Two options:

1. Before install my MOD:
1.1. Unzip (un giz, un tar) the mod *.tar.gz.
1.2. Edit file theme-default.xml and replace this

// BEGIN MOD MenuWithoutLimitLevel
// Show menu sub levels
function template_menu_sub_buttons($button)
{
// any subbuttons then?
if(!empty($button['sub_buttons']))
{
echo '
<ul>';
foreach ($button['sub_buttons'] as $sbutton)
{
echo '
<li>
<a', ((empty($sbutton['active_button'])) ? '' : ' class="active"'), ' href="', $sbutton['href'], '"', ((isset($sbutton['target'])) ? (' target="' . $sbutton['target'] . '"') : ''), '>
<span', ((isset($sbutton['is_last'])) ? ' class="last"' : ''), '>', $sbutton['title'], ((empty($sbutton['sub_buttons'])) ? '' : '...'), '</span>
</a>';
template_menu_sub_buttons($sbutton);
echo '
</li>';
}
echo '
</ul>';
}
}
// END MOD MenuWithoutLimitLevel

with this
// BEGIN MOD MenuWithoutLimitLevel
// Show menu sub levels
function template_menu_sub_buttons($button)
{
// any subbuttons then?
if(!empty($button['sub_buttons']))
{
echo '
<ul>';
foreach ($button['sub_buttons'] as $sbutton)
{
echo '
<li>
<a', ((empty($sbutton['active_button'])) ? '' : ' class="active"'), ' href="', $sbutton['href'], '"', ((isset($sbutton['target'])) ? (' target="' . $sbutton['target'] . '"') : ''), '>
<span', ((isset($sbutton['is_last'])) ? ' class="last"' : ''), '>', $sbutton['title'], '</span>
</a>';
template_menu_sub_buttons($sbutton);
echo '
</li>';
}
echo '
</ul>';
}
}
// END MOD MenuWithoutLimitLevel


1.3. Save the file
1.4. Zip all (in tar.gz or zip, is the same)

2. After intall my MOD: Do the same of step 1.2, but in file /Themes/default/index.template.php of your forum.
Title: Re: MenuWithoutLimitLevel 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: Sakae on March 15, 2010, 06:21:59 PM
Thanks David!

Working great in my SMF 2.0 RC2!
Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: thellie on August 26, 2010, 10:47:58 AM
hi, i've got it working, and it's exactly what i need... with the exception of permissions.

can some one have a quick look and tell me where i'm going wrong with the following code... i want to permission off certain levels dependent on membergroups, but can't quite work it out... a magnum of gratitude to the first one to help (correctly) :)

// Ecotours Project external pages menu
'ea' => array(
'title' => 'EcoAdmin',
'href' => '',
'show' => true,
'sub_buttons' => array(
   if (in_array(array(1,21,22), $user_info['groups']))
   {
'ea1' => array(
'title' => 'Ecotours Staff',
'href' => '',
'show' => true,
'sub_buttons' => array(
'ea11' => array(
'title' => 'Volunteer Administration / การบริหาร',
'href' => '',
'show' => true,
'sub_buttons' => array(
'ea111' => array(
'title' => 'Next intake of volunteers / ถัดไป',
'href' => $scripturl . '/page,page3981.html',
'show' => true,
),
'ea112' => array(
'title' => 'Latest volunteers / ล่าสุด',
'href' => $scripturl . '/page=pageXXXX.html',
'show' => true,
),
'ea113' => array(
'title' => 'Present volunteers / ปัจจุบัน',
'href' => $scripturl . '/page=page3835.html',
'show' => true,
),
'ea114' => array(
'title' => 'Active volunteers / ปัจจุบันกับในวันหน้า',
'href' => $scripturl . '/page=page1469.html',
'show' => true,
),
'ea115' => array(
'title' => 'Future volunteers / ในวันหน้า',
'href' => $scripturl . '/page=page366.html',
'show' => true,
),
'ea116' => array(
'title' => 'Past volunteers / ก่อน',
'href' => $scripturl . '/page=pageXXX.html',
'show' => true,
),
'ea117' => array(
'title' => 'All volunteers / ทุกคน',
'href' => $scripturl . '/page=pageXXXX.html',
'show' => true,
),
),
),
'ea12' => array(
'title' => 'Other information / ข้อมูลข่าวสารอื่น',
'href' => '',
'show' => true,
'sub_buttons' => array(
'ea121' => array(
'title' => 'Visa information / ข้อมูลวีซ่า',
'href' => '',
'show' => true,
),
'ea122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),
'ea13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),
   }

'ea2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'ea21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'ea22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),

Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: thellie on August 26, 2010, 08:16:51 PM
ok, so you can't have if statements inside arrays...

i've added the following in the function setupMenuContext()
   // Set up the menu privileges

$context['show_present_volunteers'] = (in_array(1, $user_info['groups']) || in_array(22, $user_info['groups']) || in_array(24, $user_info['groups']));
$context['show_past_volunteers'] = in_array(array(1,22,20), $user_info['groups']);


the first line works fine, but i'd like to tidy it up by having an array, ie second line... but can't get the syntax correct... can anyone help please?
Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: excaliburj on August 26, 2010, 08:52:33 PM
Try:
$context['show_past_volunteers'] = (count(array_intersect(array(1,22,20), $user_info['groups'])) == 0 ? false : true);
Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: thellie on August 26, 2010, 10:01:55 PM
excellent, works a treat :)

never would have got that on my own...

thanks very much!
Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: thellie on August 26, 2010, 11:38:48 PM
just thinking... and i'll try it when i have the stuff i need to do first, done... this should be able to work on other existing menus shouldn't it?

for instance, i'd be interested in having external pages of articles written by volunteers.

so i could extend the articles menu button (came with smf articles), in exactly the same way, and have the href point to my pages...?

------------------------------------
oh, and i never said, but i'm running my forum on 2.0 rc3, and this mod works great :)
Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: thellie on September 01, 2010, 01:18:33 AM
it's working really well on my testing server. i have one issue which is a requested addition to the mod.

can the delay be incorporated into the code somehow (i'd do it myself, but i don't know any javascript, and the stuff i looked at just confused the hell out of me) - i am going to get lots of comments about the menu disappearing as soon as the cursor wanders off the menu, so would love to pre-empt them if possible.
Title: Re: Menu without limit level, 1.0.1 (SMF 2.0 RC2, 2.0 RC3)
Post by: davidhs on September 20, 2010, 10:58:58 AM
Quote from: thellie on August 26, 2010, 11:38:48 PM
just thinking... and i'll try it when i have the stuff i need to do first, done... this should be able to work on other existing menus shouldn't it?

for instance, i'd be interested in having external pages of articles written by volunteers.

so i could extend the articles menu button (came with smf articles), in exactly the same way, and have the href point to my pages...?
I think it is possible, but depends on the code. I do not know.

Quote from: thellie on September 01, 2010, 01:18:33 AM
it's working really well on my testing server. i have one issue which is a requested addition to the mod.

can the delay be incorporated into the code somehow (i'd do it myself, but i don't know any javascript, and the stuff i looked at just confused the hell out of me) - i am going to get lots of comments about the menu disappearing as soon as the cursor wanders off the menu, so would love to pre-empt them if possible.
That would be very useful. But now I have not time. Maybe in a few months...
Title: Re: Menu without limit level, 1.0.2 (SMF 2.0 RC2 to RC4)
Post by: davidhs on November 13, 2010, 08:59:07 AM
New version:

1.0.2   2010-11-04
------------------
+ SMF compatibility: Adds 2.0 RC4.
Title: Re: Menu without limit level, 1.0.3 (SMF 2.0 RC2-RC5)
Post by: davidhs on February 13, 2011, 03:22:10 PM
New version:

1.0.3   2011-02-13
------------------
+ SMF compatibility: Adds 2.0 RC5.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: davidhs on June 21, 2011, 08:54:13 AM
New version:

1.0.4   2011-06-18
------------------
+ SMF compatibility: Adds 2.0.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: Zirc on June 25, 2011, 08:24:02 PM
Okay so I have some errors showing up on my forums and I think they are related to this mod but can't figure out what the problem is so I'm hoping that somebody can help me out.

SMF 2.0

this is the error I'm getting -  8: Undefined index: href

And these are the two lines of my index.template.php of my custom theme that it is saying the error is coming on

This one I don't think is from the mod but it looks like it could be a related issue

<h4><a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>




This one is from the mod code

<a href="', $sbutton['href'], '"', isset($sbutton['target']) ? ' target="' . $sbutton['target'] . '"' : '', '>



I don't remember getting these errors on every page load before the 2.0 upgrade but I could be mistaken.  Any help with this issue would be great, thanks.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: davidhs on June 28, 2011, 10:56:15 AM
I have not this error in SMF 2.0 forum for test

If you use my MOD, I suppose you have menu multi level. Perhaps problem are in your code when add your new menu items. In SMF 2.0 final you can use integration hooks instead of modify source code of YOUR_FORUM/Sources/Subs.php. You could apply these:

Step 1.- I suppose you have my MOD installed.

Step 2.- You create a new PHP file in YOUR_FORUM/Sources directory. In this file create a function for add your new menu. For example:
<?php

if (!defined('SMF'))
die('Hacking attempt...');

function 
menu_multi_level($buttons)
{
  global 
$txt// This line is necesary only if you write text of new menus in $txt vars 

  // In this function you can add, modify or remove items in $buttons array
  //
  // $buttons[] = ... // add new menu
}

?>

In my example I create a file with name Subs-MenuMultiLevel.php and source code:
<?php

if (!defined('SMF'))
die('Hacking attempt...');

// Adds my menu multi level between Home and Help
function menu_multi_level($buttons)
{
$buttons2 $buttons;
$buttons = array();
foreach ($buttons2 as $i => $b)
{
$buttons[$i] = $b;
if ('home' == $i)
{
$buttons['m0'] = array(
'title' => 'Menu multi-level',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1' => array(
'title' => 'Submenu 1 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm11' => array(
'title' => 'Submenu 1.1 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm111' => array(
'title' => 'Submenu 1.1.1 - level 3',
'href' => '',
'show' => true,
),
'm112' => array(
'title' => 'Submenu 1.1.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm12' => array(
'title' => 'Submenu 1.2 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm121' => array(
'title' => 'Submenu 1.2.1 - level 3',
'href' => '',
'show' => true,
),
'm122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),

'm2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'm22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),

),
);


}
}

}

?>


Step 3.- Add two lines in YOUR_FORUM/Sources/Load.php file, in line 282:
<?php

// Integration is cool.
if (defined('SMF_INTEGRATION_SETTINGS'))
{
$integration_settings unserialize(SMF_INTEGRATION_SETTINGS);
foreach ($integration_settings as $hook => $function)
add_integration_function($hook$functionfalse);
}

// NEW LINES
// Add access to new function
add_integration_function('integrate_menu_buttons''menu_multi_level'false);
// Include new file
add_integration_function('integrate_pre_include''$boarddir/Sources/Subs-MenuMultiLevel.php'false);
// END NEW LINES

// Any files to pre include?
if (!empty($modSettings['integrate_pre_include']))

?>


If do not work you can write in other post the source code of your menu items, and I could see if you have mistakes.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: Jessica. on June 28, 2011, 01:03:56 PM
sweet, I'll try it out
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: Zirc on July 13, 2011, 11:34:54 AM
Quote from: Zirc on June 25, 2011, 08:24:02 PM
Okay so I have some errors showing up on my forums and I think they are related to this mod but can't figure out what the problem is so I'm hoping that somebody can help me out.

SMF 2.0

this is the error I'm getting -  8: Undefined index: href

And these are the two lines of my index.template.php of my custom theme that it is saying the error is coming on

This one I don't think is from the mod but it looks like it could be a related issue

<h4><a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>




This one is from the mod code

<a href="', $sbutton['href'], '"', isset($sbutton['target']) ? ' target="' . $sbutton['target'] . '"' : '', '>



I don't remember getting these errors on every page load before the 2.0 upgrade but I could be mistaken.  Any help with this issue would be great, thanks.

Okay so I found the problem after doing a Google search.  My issue was that I had some buttons that I didn't put a 'href' in there because I didn't want it to be clickable.  The solution was to just do 'href' => '#', for each of those buttons.  Thought this might help for anybody that gets the same issue.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: MiY4Gi on August 11, 2011, 04:33:23 PM
Great mod. Just what I needed. Now I got a fully equipped, drop down forum menu.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: Zirc on August 21, 2011, 01:55:21 PM
I was wondering if somebody could help me out with this, should be an easy fix but I don't know how to do it.  When I am in the Admin section of the forums and I hover over a button that has a drop down the menu goes behind the admin buttons (see attached image) How can I fix this so the menu goes above the Admin buttons?

Thanks

SMF 2.0
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: davidhs on August 22, 2011, 07:07:09 AM
Now I can not see source code of SMF for test but... perhaps if you modify css file of your theme or default theme

DIR_FORUM/Themes/YOUR_THEME_OR_DEFAULT/css/index.css
line 1107 (in 2.0 RC5) /* Styles for the standard dropdown menus.
and next
Title: Re: Menu without limit level, 1.0.5 (SMF 2.0 RC2-2.0.1)
Post by: davidhs on September 21, 2011, 02:01:07 PM
New version:

1.0.5   2011-09-20
------------------
+ SMF compatibility: Adds 2.0.1.
Title: Re: Menu without limit level, 1.0.4 (SMF 2.0 RC2-2.0)
Post by: Zirc on November 04, 2011, 11:59:22 PM
Quote from: Zirc on August 21, 2011, 01:55:21 PM
I was wondering if somebody could help me out with this, should be an easy fix but I don't know how to do it.  When I am in the Admin section of the forums and I hover over a button that has a drop down the menu goes behind the admin buttons (see attached image) How can I fix this so the menu goes above the Admin buttons?

Thanks

SMF 2.0

I'm still having this problem and it's annoying so I'm attaching my index.css for the theme on the site in hopes that somebody can help.  Lines 4025 thru 4207 are the styles for the main navigation bar (the one whose dropdowns are going behind the adm_container).  I've tried adjusting the z-index of many different things and nothing seems to work so I'm back here looking for pointers.

Thanks
Title: Re: Menu without limit level, 1.0.5 (SMF 2.0 RC2-2.0.1)
Post by: davidhs on November 05, 2011, 08:50:00 AM
Quote from: Zirc on November 04, 2011, 11:59:22 PM
Quote from: Zirc on August 21, 2011, 01:55:21 PM
I was wondering if somebody could help me out with this, should be an easy fix but I don't know how to do it.  When I am in the Admin section of the forums and I hover over a button that has a drop down the menu goes behind the admin buttons (see attached image) How can I fix this so the menu goes above the Admin buttons?

Thanks

SMF 2.0

I'm still having this problem and it's annoying so I'm attaching my index.css for the theme on the site in hopes that somebody can help.  Lines 4025 thru 4207 are the styles for the main navigation bar (the one whose dropdowns are going behind the adm_container).  I've tried adjusting the z-index of many different things and nothing seems to work so I'm back here looking for pointers.

Thanks
I think I solve your problem :). I copy your index.css in default theme of 2.0 forum and I have corrected it.

The problem is your theme (my MOD does not change anything important).

You must make changes to the file index.css. Line 3923
.dropmenu li ul
{
z-index: 200; // line 3923

replace by
.dropmenu li ul
{
z-index: 90; // line 3923


I suppouse this is all, but perhaps you need delete lines 3906 and 3918
z-index: 200;
Title: Re: Menu without limit level, 1.0.5 (SMF 2.0 RC2-2.0.1)
Post by: Zirc on November 05, 2011, 12:55:33 PM
Thanks for your help davidhs.  Although your suggestion didn't work it got me doublechecking all the code in the index.css again and I found that I had another div wrapping the div for my navigation bar that was being hidden.  Once I changed the z-index of that div it fixed the problem.
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: davidhs on December 25, 2011, 02:28:14 PM
New version:
1.0.6   2011-12-24
------------------
! Some modifications of index.css of theme are not neccesary.
+ SMF compatibility: Adds 2.0.2.
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: SKOTINOS_AGELOS on January 06, 2012, 11:42:31 AM
After installation is not displayed in admin panel?
And I can not find it  to set  up it !
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: davidhs on January 06, 2012, 03:23:18 PM
Quote from: SKOTINOS_AGELOS on January 06, 2012, 11:42:31 AM
After installation is not displayed in admin panel?
And I can not find it  to set  up it !
This MOD have not admin panel. It only adds support to unlimited number of levels.

You must create menu as usual: modify file Subs.php or, if your forum is 2.0 RC4 or next, use integration hooks. I explain how make this in first post (see example)
http://www.simplemachines.org/community/index.php?topic=369595.msg2528782#msg2528782
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: SKOTINOS_AGELOS on January 06, 2012, 05:55:37 PM
thanks  :P
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: Rex Zac on February 03, 2012, 07:25:12 AM
how can i put open in new window?
this doesnt work:
'href' => 'http://www.myurl.net' target="_blank",
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: davidhs on February 03, 2012, 10:54:30 AM
Quote from: Rex Zac on February 03, 2012, 07:25:12 AM
how can i put open in new window?
this doesnt work:
'href' => 'http://www.myurl.net' target="_blank",
This feature is not of my MOD, else of SMF. Perhaps...
'href' => 'http://www.myurl.net', target => "_blank",
;)
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: Rex Zac on February 03, 2012, 06:45:04 PM
thanks, works great!
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: Rex Zac on February 08, 2012, 05:21:14 PM
ok, one more problem ;)

I moved from linux on windows, and am getting this error:

Administrator
my IP   
    Today in 23:17
82528079dd6d2a261108b50642dcf993
Error: not defined

http://www.myurl.info/forum/index.php?8:
Use of undefined constant target - assumed 'target'
Data: mypath/wwwroot/forum/Sources/Subs-MenuMultiLevel.php
Line: 72

do u know maybe how to solve this? even it does work, am getting my error log filled fast
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: davidhs on February 08, 2012, 05:42:12 PM
On linux works and on windows have error?

I need see your file
Quote from: Rex Zac on February 08, 2012, 05:21:14 PM
mypath/wwwroot/forum/Sources/Subs-MenuMultiLevel.php

Can you attach here?
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: Rex Zac on February 09, 2012, 05:46:42 AM
correctily.
It works on linux and win, however, on win I am getting error as I copied


here it is, even I put comments now on this problematic part of code so I dont get spammed of errors.
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: davidhs on February 09, 2012, 06:19:43 AM
Excuse me. :-[

My previous correction is wrong. I wrote a typo.

target must be quoted
'href' => 'http://www.myurl.net', 'target' => "_blank",
Title: Re: Menu without limit level, 1.0.6 (SMF 2.0 RC2-2.0.2)
Post by: Rex Zac on February 10, 2012, 07:15:39 AM
Thanks ;)
Title: Re: Menu without limit level, 1.0.7 (SMF 2.0 RC2-2.0.3)
Post by: davidhs on December 22, 2012, 06:08:14 AM
New version:
1.0.7   2012-12-22
------------------
+ SMF compatibility: Adds 2.0.3.
Title: Re: Menu without limit level, 1.0.8 (SMF 2.0-2.0.4)
Post by: davidhs on April 09, 2013, 03:27:24 PM
New version:
1.0.8   2013-04-09
------------------
+ SMF compatibility: Adds 2.0.4.
- SMF compatibility: Removes support to RC versions.
Title: Re: Menu without limit level, 1.0.9 (SMF 2.0-2.0.5)
Post by: davidhs on August 19, 2013, 07:48:29 AM
New version:
1.0.9   2013-08-18
------------------
@ This work is licensed under a Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/
+ SMF compatibility: Adds 2.0.5.
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: davidhs on October 24, 2013, 11:54:48 AM
New version:
1.0.10  2013-10-24
------------------
+ SMF compatibility: 2.0.6.
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: handy1 on January 06, 2014, 05:03:37 AM
How I can change sub buttons background colour?



Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: davidhs on January 06, 2014, 06:02:38 AM
Quote from: handy1 on January 06, 2014, 05:03:37 AM
How I can change sub buttons background colour?
Change CSS or create new rules
.dropmenu li li
{
background: url(../images/theme/menu_gfx_new.png) no-repeat 100% xxxpx;
}

and create other image with your colour like this
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: handy1 on January 06, 2014, 07:25:25 AM
Auts, looks difficult if only editorskills is Paint ;D

But thanks anyway, now I know what to do.
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: handy1 on January 06, 2014, 10:59:13 AM
Now I understand what is the problem. It's not the colour. Buttons background is transparent...that makes messy, because long button list goes over forum categories.

So how I can make it no transparent :-\
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: davidhs on January 06, 2014, 12:25:01 PM
Quote from: handy1 on January 06, 2014, 10:59:13 AM
Now I understand what is the problem. It's not the colour. Buttons background is transparent...that makes messy, because long button list goes over forum categories.

So how I can make it no transparent :-\
Perhaps, on CSS
background-color: ...
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: handy1 on January 07, 2014, 01:56:21 AM
It's good background up to 9 buttons, but after 10---> it's transparent and hard to read.

- Stretch your background image?
- Some code like "repeat"?


E: No time to wait answer so I tried it. You gave image .png for me and I stretched it 3 times longer and now it works.
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: davidhs on January 07, 2014, 06:13:11 AM
I think the rule
.dropmenu li li.additional_items
{
background-color: #fff;
}

is for this.
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: handy1 on January 09, 2014, 03:08:17 PM
Now I've two menu ready.

My site (http://vihjepaikka.com/keskustelut/forum/)

But I can't work with third level buttons. I don't know why it doesn't work. I copied this topic first posts code what include third level buttons (right?) and used it.

If someone could write test code for me example:

Menu name: TEST
LEVEL 1: TEST1
LEVEL 2: TEST2
LEVEL 3: TEST3

So I can try it tomorrow..

Thanks ;)
Title: Re: Menu without limit level, 1.0.10 (SMF 2.0-2.0.6)
Post by: davidhs on January 09, 2014, 04:12:44 PM
Quote from: handy1 on January 09, 2014, 03:08:17 PM
Now I've two menu ready.

My site (http://vihjepaikka.com/keskustelut/forum/)

But I can't work with third level buttons. I don't know why it doesn't work. I copied this topic first posts code what include third level buttons (right?) and used it.

If someone could write test code for me example:

Menu name: TEST
LEVEL 1: TEST1
LEVEL 2: TEST2
LEVEL 3: TEST3

So I can try it tomorrow..

Thanks ;)

You forum is SMF 2.0.6 and you can use integration hooks. Do this:
Quote from: davidhs on March 08, 2010, 03:47:03 PM
Quote1. Create the file Sources/Subs-MenuMultiLevel.php with content
<?php

if (!defined('SMF'))
die('Hacking attempt...');

function 
menu_multi_level($buttons)
{
$buttons2 $buttons;
$buttons = array();
foreach ($buttons2 as $i => $b)
{
$buttons[$i] = $b;
if ('home' == $i)
{
'm0' => array(
'title' => 'Menu multi-level',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1' => array(
'title' => 'Submenu 1 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm11' => array(
'title' => 'Submenu 1.1 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm111' => array(
'title' => 'Submenu 1.1.1 - level 3',
'href' => '',
'show' => true,
),
'm112' => array(
'title' => 'Submenu 1.1.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm12' => array(
'title' => 'Submenu 1.2 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm121' => array(
'title' => 'Submenu 1.2.1 - level 3',
'href' => '',
'show' => true,
),
'm122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),

'm2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'm22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),

),
);

}
}

}

?>


2. In file Sources/Load.php, find
// 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);
}

and add after
add_integration_function('integrate_menu_buttons', 'menu_multi_level', false);
add_integration_function('integrate_pre_include', '$boarddir/Sources/Subs-MenuMultiLevel.php', false);
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.7)
Post by: davidhs on January 25, 2014, 08:33:48 AM
New version:
1.0.11  2014-01-24
------------------
! Error in source code.
+ SMF compatibility: 2.0.7.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.8)
Post by: davidhs on June 24, 2014, 08:54:14 AM
Compatible with SMF 2.0.8.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: davidhs on October 06, 2014, 07:57:15 AM
Compatible with SMF 2.0.9.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: MyTime on November 07, 2014, 01:58:55 AM
I'v tried too use the parse version for the install of this mod and it brought me too a page of codes, I tried too install the codes, but it did not seem too work, any tips or advice?
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: davidhs on November 07, 2014, 07:18:24 AM
Quote from: CannabisGamerClub on November 07, 2014, 01:58:55 AM
I'v tried too use the parse version for the install of this mod and it brought me too a page of codes, I tried too install the codes, but it did not seem too work, any tips or advice?
I do not understand your problem. Can you not install it on your forum? What is your version of SMF? This mod can be install on default theme (and perhaps others themes).
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: MyTime on November 22, 2014, 03:20:58 AM
getting these in the console but idk if its related too the problem, When I go to add a page, i click internal or external but it doesn't give me the option too add the link for the button, wont let me add the button.

Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/css/menu_css/main.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/scripts/menu_scripts/main.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/images/slide/slider6.jpg
Uncaught ReferenceError: addButtonJS is not defined index.php?action=admin;area=menueditor;sa=add;e7953d8c0=fbcb8a11436c1967dc018d9bfeab674e:115
Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/css/menu_css/main.css
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: davidhs on November 22, 2014, 05:33:45 AM
Quote from: CannabisGamerClub on November 22, 2014, 03:20:58 AM
getting these in the console but idk if its related too the problem, When I go to add a page, i click internal or external but it doesn't give me the option too add the link for the button, wont let me add the button.

Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/css/menu_css/main.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/scripts/menu_scripts/main.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/images/slide/slider6.jpg
Uncaught ReferenceError: addButtonJS is not defined index.php?action=admin;area=menueditor;sa=add;e7953d8c0=fbcb8a11436c1967dc018d9bfeab674e:115
Failed to load resource: the server responded with a status of 404 (Not Found) http://forum.cannabisgamerclub.com/Themes/zGames/css/menu_css/main.css
I am sorry, I do not understand the problem. This mod not add JavaScript (like addButtonJS). Perhaps you have installed other mod and my mod do not work with this... I do not know...

If you can, put images of screen with steps.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: MyTime on November 22, 2014, 08:22:35 AM
Did you want steps of the install?
I did some of the problem I get
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: davidhs on November 22, 2014, 11:35:03 AM
I install "Menu Editor Lite" mod http://custom.simplemachines.org/mods/index.php?mod=3310 in my test forum and these mods are incompatible :( You can not install both in your forum.

"Menu Editor Lite" mod allow easy edit menu buttom, but only two levels.

"Menu without limit level" mod allow multi level. In first post of this topic http://www.simplemachines.org/community/index.php?topic=369595.0 you can see an example for edit menu button using PHP code.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.9)
Post by: davidhs on May 23, 2015, 12:09:59 PM
To moderators: Text to move to first post
QuoteSubject:
QuoteMenu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Body:
Quote
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2454)




Menu without limit level

ABOUT...

Menu without limit level, 1.0.11
© 2010-2015 by davidhs

(http://creativecommons.org/licenses/by/3.0/)
This work is licensed under a Creative Commons Attribution 3.0 Unported License (http://creativecommons.org/licenses/by/3.0/).

DESCRIPTION

Adds the possibility that the top menu of the forum has any number of levels.

Modifies:

  • Code which defines the menu to allow any number of levels.
  • Default theme to show up to 10 levels (main menu and 9 levels of submenus) because of CSS.


EXAMPLE

To create this menu, similar to the image,

QuoteMenu multi-level

  • Submenu 1 - level 1

    • Submenu 1.1 - level 2

      • Submenu 1.1.1 - level 3
      • Submenu 1.1.2 - level 3
    • Submenu 1.2 - level 2

      • Submenu 1.2.1 - level 3
      • Submenu 1.2.2 - level 3
    • Submenu 1.3 - level 2
  • Submenu 2 - level 1

    • Submenu 2.1 - level 2
    • Submenu 2.1 - level 2

can modify the file Sources/Subs.php

QuoteIn function setupMenuContext() add code
'm0' => array(
'title' => 'Menu multi-level',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1' => array(
'title' => 'Submenu 1 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm11' => array(
'title' => 'Submenu 1.1 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm111' => array(
'title' => 'Submenu 1.1.1 - level 3',
'href' => '',
'show' => true,
),
'm112' => array(
'title' => 'Submenu 1.1.2 - level 3',
'href' => '',
'show' => true,
),
),
),
'm12' => array(
'title' => 'Submenu 1.2 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm121' => array(
'title' => 'Submenu 1.2.1 - level 3',
'href' => '',
'show' => true,
),
'm122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),
'm13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),
'm2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'm22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),
),
),

or use integration hooks

Quote1. Create the file Sources/Subs-MenuMultiLevel.php with content
<?php

if (!defined('SMF'))
die('Hacking attempt...');

function 
menu_multi_level($buttons)
{
$buttons2 $buttons;
$buttons = array();
foreach ($buttons2 as $i => $b)
{
$buttons[$i] = $b;
if ('home' == $i)
{
'm0' => array(
'title' => 'Menu multi-level',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1' => array(
'title' => 'Submenu 1 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm11' => array(
'title' => 'Submenu 1.1 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm111' => array(
'title' => 'Submenu 1.1.1 - level 3',
'href' => '',
'show' => true,
),
'm112' => array(
'title' => 'Submenu 1.1.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm12' => array(
'title' => 'Submenu 1.2 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm121' => array(
'title' => 'Submenu 1.2.1 - level 3',
'href' => '',
'show' => true,
),
'm122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),

'm2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'm22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),

),
);

}
}

}

?>


2. In file Sources/Load.php, find
// 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);
}

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

SMF COMPATIBILITY


  • SMF 2.0 to 2.0.10.

DOWNLOAD

Link to MOD (http://custom.simplemachines.org/mods/index.php?mod=2454)

MANUAL INSTALLATION

See http://wiki.simplemachines.org/smf/Manual_installation_of_mods

SUPPORT AND COMMENTS

In English: http://www.simplemachines.org/community/index.php?topic=369595.0
In Spanish: http://www.simplemachines.org/community/index.php?topic=367071.0

CHANGE LOG

Legend:   ! Fixed   + Added   - Removed   * Changed   @ Note

1.0.11  2014-01-24
------------------
! Error in source code.
+ SMF compatibility: 2.0.7.

1.0.10  2013-10-24
------------------
+ SMF compatibility: 2.0.6.

1.0.9   2013-08-18
------------------
@ This work is licensed under a Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/
+ SMF compatibility: 2.0.5.

1.0.8   2013-04-09
------------------
+ SMF compatibility: 2.0.4.
- SMF compatibility: Support to RC versions.

1.0.7   2012-12-22
------------------
+ SMF compatibility: 2.0.3.

1.0.6   2011-12-24
------------------
! Some modifications of index.css of theme are not neccesary.
+ SMF compatibility: 2.0.2.

1.0.5   2011-09-20
------------------
+ SMF compatibility: 2.0.1.

1.0.4   2011-06-18
------------------
+ SMF compatibility: 2.0.

1.0.3   2011-02-13
------------------
+ SMF compatibility: 2.0 RC5.

1.0.2   2010-11-04
------------------
+ SMF compatibility: 2.0 RC4.

1.0.1   2010-03-10
------------------
! In 2.0 RC2, levels 4 and more show and hide at a time.
+ SMF compatibility: 2.0 RC3.

1.0     2010-03-08
------------------
+ SMF compatibility: 2.0 RC2.
+ Themes: default.





Compatible with SMF 2.0.10.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: DenDen60 on August 08, 2015, 12:30:50 PM
I receive this message when I installed the latest version on 2.0.10


Execute Modification./Themes/core/index.template.phpTest failed

(http://tinc.ca/NA-CANADA/index.php?action=admin;area=packages;sa=showoperations;operation_key=11;package=MenuWithoutLimitLevel_1.0.11.tar.gz;filename=modification-2.0.xml)1.Replace./Themes/core/index.template.phpTest failed

Execute Modification./Themes/core/css/index.cssTest failed

(http://tinc.ca/NA-CANADA/index.php?action=admin;area=packages;sa=showoperations;operation_key=18;package=MenuWithoutLimitLevel_1.0.11.tar.gz;filename=modification-2.0.xml)1.Replace./Themes/core/css/index.cssTest failed

(http://tinc.ca/NA-CANADA/index.php?action=admin;area=packages;sa=showoperations;operation_key=19;package=MenuWithoutLimitLevel_1.0.11.tar.gz;filename=modification-2.0.xml)2.Replace./Themes/core/css/index.cssTest failed

I do have a two MODs installed:

EZportal
Footer Menu

and use the default theme for SMF
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: DenDen60 on August 08, 2015, 10:03:01 PM
I installed one on a SMF version where no other MODs were installed.  (v.2.0.9) and I got the same message.

I installed it anyway and it did installed alright even if I had the same messages.  However, there is no  place where I see where I can create a menu. :-(
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: davidhs on August 09, 2015, 07:31:29 AM
Quote from: Denis Pageau on August 08, 2015, 12:30:50 PM
I receive this message when I installed the latest version on 2.0.10


Execute Modification./Themes/core/index.template.phpTest failed

(http://tinc.ca/NA-CANADA/index.php?action=admin;area=packages;sa=showoperations;operation_key=11;package=MenuWithoutLimitLevel_1.0.11.tar.gz;filename=modification-2.0.xml)1.Replace./Themes/core/index.template.phpTest failed

Execute Modification./Themes/core/css/index.cssTest failed

(http://tinc.ca/NA-CANADA/index.php?action=admin;area=packages;sa=showoperations;operation_key=18;package=MenuWithoutLimitLevel_1.0.11.tar.gz;filename=modification-2.0.xml)1.Replace./Themes/core/css/index.cssTest failed

(http://tinc.ca/NA-CANADA/index.php?action=admin;area=packages;sa=showoperations;operation_key=19;package=MenuWithoutLimitLevel_1.0.11.tar.gz;filename=modification-2.0.xml)2.Replace./Themes/core/css/index.cssTest failed

I do have a two MODs installed:

EZportal
Footer Menu

and use the default theme for SMF

Quote from: Denis Pageau on August 08, 2015, 10:03:01 PM
I installed one on a SMF version where no other MODs were installed.  (v.2.0.9) and I got the same message.

I installed it anyway and it did installed alright even if I had the same messages.  However, there is no  place where I see where I can create a menu. :-(
This mod only install in default theme of SMF 2.0.x series. If you uses this theme do not worry, you do not need install in core theme.

Core theme of SMF 2.0.x series is similar to default theme of SMF 1.1.x series and this mod do not works in this.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: DenDen60 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.
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: davidhs on August 10, 2015, 07:04:20 AM
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).
Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: DenDen60 on August 17, 2015, 10:27:06 AM
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.






Title: Re: Menu without limit level, 1.0.11 (SMF 2.0-2.0.10)
Post by: davidhs on August 18, 2015, 09:02:22 AM
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.
Title: Re: Menu without limit level
Post by: DenDen60 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.
Title: Re: Menu without limit level
Post by: DenDen60 on August 19, 2015, 09:04:21 AM
I have check the files listed here (http://custom.simplemachines.org/mods/index.php?action=parse) 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?
Title: Re: Menu without limit level
Post by: davidhs on August 20, 2015, 07:29:51 AM
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 (http://custom.simplemachines.org/mods/index.php?action=parse) 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.
Title: Re: Menu without limit level
Post by: DenDen60 on August 20, 2015, 08:34:16 AM
Here you go.

Thanks
Title: Re: Menu without limit level
Post by: davidhs on August 22, 2015, 08:40:44 AM
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.
Title: Re: Menu without limit level
Post by: DenDen60 on August 22, 2015, 10:07:38 AM
OK I will check this out and let you know.

Thanks
Denis
Title: Re: Menu without limit level
Post by: davidhs on September 26, 2015, 08:35:31 AM
Compatible with SMF 2.0.11.
Title: Re: Menu without limit level
Post by: davidhs on October 12, 2016, 09:21:28 AM
Compatible with SMF 2.0.12.
Title: Re: Menu without limit level
Post by: davidhs on January 12, 2017, 03:56:44 PM
Compatible with SMF 2.0.13.
Title: Re: Menu without limit level
Post by: davidhs on November 25, 2017, 12:18:36 PM
Compatible with SMF 2.0.14 and 2.0.15.
Title: Re: Menu without limit level
Post by: davidhs on December 23, 2017, 08:34:35 AM
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.
Title: Re: Menu without limit level
Post by: davidhs on April 12, 2019, 12:28:40 PM
New version:
2.0.1   2019-04-09
------------------
+ SMF compatibility: 2.1 RC1 to RC2.
Title: Re: Menu without limit level
Post by: davidhs on March 05, 2020, 03:45:05 PM
Compatible with SMF 2.0.16 and 2.0.17.
Title: Re: Menu without limit level
Post by: davidhs on February 17, 2021, 04:37:47 PM
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.
Title: Re: Menu without limit level
Post by: davidhs on February 21, 2021, 09:30:11 AM
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%; }');
Title: Re: Menu without limit level
Post by: 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)
Title: Re: Menu without limit level
Post by: davidhs on June 06, 2021, 10:50:30 AM
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/
Title: Re: Menu without limit level
Post by: Grammy on June 06, 2021, 02:08:11 PM
Quote from: davidhs on June 06, 2021, 10:50:30 AM
SMF 2.1 adds icons to all menu items of level 1. But you can change the default icon.


That's just what I need; thanks so much, davidhs!  It's a very nice mod!   :)