Use of menu sub-buttons?

Started by JPDeni, September 02, 2009, 04:45:21 PM

Previous topic - Next topic

JPDeni

Is there a theme available which makes use of the menu sub-buttons so that I can see how they're used? Or, if they are used in one of the themes in the install package, could I get a pointer as to where they are? I can't find a reference to them anywhere.

Thanks!  :D

shadow82x

#1
Submenus as in dropdowns of normal menus?
Colin B
Former Spammer, Customize, & Support Team Member

JPDeni

Actually, I was trying to figure out the new menu system and how the sub-buttons work there. Might as well take the new functions into account. It would use the buttons and sub-buttons that are defined in Subs.php.

shadow82x

#3
For references you may want to look at a few themes that take advantage of the new menu/sub menu system.

Like: http://custom.simplemachines.org/themes/index.php?lemma=1830
or
http://custom.simplemachines.org/themes/index.php?lemma=1626
Colin B
Former Spammer, Customize, & Support Team Member

JPDeni

QuoteFor references you may want to look at a few themes that take advantage of the new menu/sub menu system.

That's what I was asking for. :) Thank you!

Arantor

Are there any further concerns or questions about this?

JPDeni

Well, yes, sorta. I wasn't able to figure out how to use the menu system, even with downloading the themes that were referenced. So I went to Dynamic Drive and found a drop-down menu thing that will work.

So... the original question about how to use the sub-buttons within SMF 2.0 still stands. But I've worked around the lack if information.

Arantor

Unfortunately exactly how it's displayed is theme dependent, but you'd be looking at template_menu to see where the theme handles it; the actual sub menus are defined and moved into $context['menu_buttons'] if you want to examine the structure.

JPDeni

I would just really like a clear-cut example using the default theme. I was surprised that it wasn't a part of the SMF 2.0 package. But I do have a workable menu now, so I guess that's all that I need. I know I'll have to alter it if I add any mods that add to the menu, but I can do that, too.

Thanks. :D

Arantor

That's something we can get added to the manual, but part of the reason it hasn't been thus far is because with RC2 a whole new default theme will be released, which will change how the theme will use it.

JPDeni

I see.

Well, I'm working right now on trying to get the button array to work with what I've got. It would make things easier, as long as any updates further down the line don't replace the Subs.php file. That is a bit of a concern lurking in the back of my brain.

Tyrsson

The Subs file will not be replaced. The menu "content" being split from the style was just added in the 2.0 version. Before it was all in the index template. Which means that the menu content is pretty safe for the moment :)
PM at your own risk, some I answer, if they are interesting, some I ignore.

Arantor

Sure the setup is the same in Subs.php - hence examining $context['menu_buttons'] - but how that gets displayed is theme dependent.

The core theme doesn't use submenus by default for the main menu for example.

JPDeni

I understand that the core theme doesn't use submenus. What I was saying is that, while there are submenus defined in the Subs.php file, I am surprised that the default menu does not use submenus. If it was me who developed SMF 2.0 (and I know it's not :D ), I would have incorporated submenus into the default theme so that people would easily be able to see how to use the new feature.

As for the Subs.php file not being replaced, maybe things will be different with SMF 2.0, but I know there are a number of files that are replaced during minor updates that I didn't expect with SMF 1.x and that caused a lot of trouble for me on my site. Once burned, etc.

QuoteBefore it was all in the index template.

Which is where mine is now in SMF 2.0 because I had trouble using the $context['menu_buttons'] array. But I'm working on it again.

I appreciate the responses. :D

Arantor

And the intended default theme of 2.0 - Curve - does indeed use them.

JPDeni

Thanks. This is a learning experience, so it's all good.

Arantor

The thing to do is just include SSI.php on a page, then export the contents of $context['menu_buttons'] using print_r and examine its full structure there, it is often clearer on the page like that IMO.

JPDeni

That's not the issue for me. It's "foreach"-ing through the array and formatting the output to work with the javascript that I got from Dynamic Drive. So far so good.

Arantor

Well, understanding the structure of it will be essential to foreaching through it, especially since you'll need to foreach within a foreach loop.

JPDeni

I do understand the structure. That's why it's not an issue. :)

It seems to be working better this time than it was before. Not sure what I was doing wrong. I'm just adding things gradually and testing each thing as I add it so I can see where I go wrong.

Advertisement: