News:

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

Main Menu

Custom Site Menu

Started by Tyrsson, November 24, 2009, 12:46:45 AM

Previous topic - Next topic

Tyrsson

Link to Mod

Compatibility

For SMF 2.0 RC1.2 - 2.0RC2 ONLY

Thanks goes to Nas for some help with a feature that will be in the next release.

(It will NOT work SMF 1.x - and I don't intend to make one for it.)

Introduction
Enables a completely customizable site menu. So you can link back to your main site or outside links.

The menu allows for 1 main tab and up to 5 subtabs. Values for all tabs such as title and url are entered in the admincp under Modification Settings.
Features

o Allows options for a single main menu tab and subtabs.
- All tab values are entered in the admincp.
- Allows for menu to be enabled or disabled.
- Allows for sub tabs to be enabled or disabled.
- Allows for all tabs to open in a new window or tab.
(Please note this feature will not work in the RC1.2 version)

- English/English-utf8
- English_British/English_British-utf8
I welcome translations for other languages. Please post the translated language strings in the Support Topic.

Installation
Any previous versions of this mod MUST be uninstalled BEFORE installing this version.

Useful Links
Manual Installation Of Mods
How Do I Modify Files?
Support
Please use the modification thread for support with this modification or you can visit http://www.tyrsson.com
(Please don't ask me to do the edits for you)
Changelog

v1.0 - 8th Aug 2009
o Initial release

Future release will add many new options, possibly a user specific menu from the profile.
PM at your own risk, some I answer, if they are interesting, some I ignore.

Smoky "Rider" Blue

**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

Tyrsson

http://www.tyrsson.com

Its the tab listed as "Related Sites".

There is no access to admin, but its my person site so I am not going to open that.
PM at your own risk, some I answer, if they are interesting, some I ignore.

Smoky "Rider" Blue

QuoteThe page you requested http://charter.net/404.php?src=toolbar2&error=dns&q=http://www.tyrsson.com/ is not available. If you had this page bookmarked or were directed from a search engine, the page may have expired. If you typed in the address, please check that you keyed it in correctly. Otherwise, please visit the home page.

:o i musta caught it when it was up.. kewl Tyrsson..  ;D
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

ormuz


anto74

Thanks Tyrsson, great Mod!
In my forum RC2 works perfect! ( sorry for my english)
One question: it's possible add 1 other main menu tab with subtabs?
Thanks
Antonio

Tyrsson

If you cross check the code that is added by the mod in the install.xml file(s) you should be able to duplicate the code fairly easily. Or, you can simply code a new tab and subtabs into the menu in Subs.php.
PM at your own risk, some I answer, if they are interesting, some I ignore.

anto74

Quote from: Tyrsson™ on November 26, 2009, 11:14:31 AM
If you cross check the code that is added by the mod in the install.xml file(s) you should be able to duplicate the code fairly easily. Or, you can simply code a new tab and subtabs into the menu in Subs.php.
Ok, thanks!
Antonio

kingkingston

This is something i have been looking for :D

shumilica

Good mod, but why can't we put as many buttons (and sub-buttons) as we like in the main menu? :-?

Thank you for your work!
Today, if you're not confused it means you're not thinking clear!

Tyrsson

Well you can but you will need to edit ManageSettings.php. Very last function. You will also need to code language strings for the new options.
PM at your own risk, some I answer, if they are interesting, some I ignore.

WhiteFly

Thanks Tyrsson, very great mod!

I've a request...

Is possible to disable the redirection of main site menu tab if the "Url for the main site menu tab" field is empty?

And also I offer my help to translate the mod in italian, are you interested?

Ciao!

Graziano

Tyrsson

Yep, just post the translation to the mod thread.

Uhm, not sure I understand what your trying to do. If the url field is empty then it should not show actually.
PM at your own risk, some I answer, if they are interesting, some I ignore.

WhiteFly

Quote from: Tyrsson™ on December 20, 2009, 02:34:07 AM
Yep, just post the translation to the mod thread.

Ok!  :)

Quote from: Tyrsson™ on December 20, 2009, 02:34:07 AM
Uhm, not sure I understand what your trying to do. If the url field is empty then it should not show actually.

I mean...

If I want to use only the 5 subtabs?

Example...

GALLERY --> no link
- SUNSETS --> link 1
- SKYLINES --> link 2
- ... --> link 3
- ... --> link 4
- ... --> link 5

Now I have to assign a link to "Url for the main site menu tab (home page)" otherwise, clicking on it, try to go to a link does not exist.

Graz

Arantor

The menu code doesn't really like not having links being passed.

Random thought, have it check if the link destination is empty and if it is, adding # to it instead.

WhiteFly

Quote from: The Grinch on December 20, 2009, 05:42:12 AM
The menu code doesn't really like not having links being passed.

Random thought, have it check if the link destination is empty and if it is, adding # to it instead.

:) :) :) :) :)

With "#" the problem is solved!

Thanks!

Graziano

P.S.  Translation into Italian will arrive as soon as possible!!!

WhiteFly

And this is the code to add in the install.xml with the italian (ISO & UTF8) translation.

<file name="$languagedir/Modifications.italian.php">
    <operation>
    <search position="end" />
    <add><![CDATA[
//Start SiteMenu strings
//Admin menu,page title and settings description
$txt['admin_menu_value'] = 'Custom Site Menu';
$txt['smenu_settings_title'] = 'Configurazione Custom Site Menu';
$txt['smenu_settings_desc'] = 'Modifica la configurazione del Custom Site Menu';
//Strings for the settings area
$txt['smenu_enabled'] = 'Abilita Custom Site Menu';
$txt['smenu_inline_enabled'] = 'Abilita l\'inline top menu';
$txt['smenu_enable_new_window'] = 'Abilita l\'apertura in una nuova finestra';
$txt['smenu_sub_tab_enabled'] = 'Abilita i Custom Site Menu Sub Tabs';
$txt['smenu_main_tab_title'] = 'Titolo del Custom Site Menu tab principale (home page)';
$txt['smenu_main_tab_url'] = 'Url del Custom Site Menu tab principale (home page)';
$txt['smenu_sub_tab_title0'] = 'Sub tab 0, titolo';
$txt['smenu_sub_tab_url0'] = 'Sub tab 0, url';
$txt['smenu_sub_tab_title1'] = 'Sub tab 1, titolo';
$txt['smenu_sub_tab_url1'] = 'Sub tab 1, url';
$txt['smenu_sub_tab_title2'] = 'Sub tab 2, titolo';
$txt['smenu_sub_tab_url2'] = 'Sub tab 2, url';
$txt['smenu_sub_tab_title3'] = 'Sub tab 3, titolo';
$txt['smenu_sub_tab_url3'] = 'Sub tab 3, url';
$txt['smenu_sub_tab_title4'] = 'Sub tab 4, titolo';
$txt['smenu_sub_tab_url4'] = 'Sub tab 4, url';
//End SiteMenu Strings
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.italian-utf8.php" error="skip">
    <operation>
        <search position="end" />
        <add><![CDATA[
//Start SiteMenu strings
//Admin menu,page title and settings description
$txt['admin_menu_value'] = 'Custom Site Menu';
$txt['smenu_settings_title'] = 'Configurazione Custom Site Menu';
$txt['smenu_settings_desc'] = 'Modifica la configurazione del Custom Site Menu';
//Strings for the settings area
$txt['smenu_enabled'] = 'Abilita Custom Site Menu';
$txt['smenu_inline_enabled'] = 'Abilita l\'inline top menu';
$txt['smenu_enable_new_window'] = 'Abilita l\'apertura in una nuova finestra';
$txt['smenu_sub_tab_enabled'] = 'Abilita i Custom Site Menu Sub Tabs';
$txt['smenu_main_tab_title'] = 'Titolo del Custom Site Menu tab principale (home page)';
$txt['smenu_main_tab_url'] = 'Url del Custom Site Menu tab principale (home page)';
$txt['smenu_sub_tab_title0'] = 'Sub tab 0, titolo';
$txt['smenu_sub_tab_url0'] = 'Sub tab 0, url';
$txt['smenu_sub_tab_title1'] = 'Sub tab 1, titolo';
$txt['smenu_sub_tab_url1'] = 'Sub tab 1, url';
$txt['smenu_sub_tab_title2'] = 'Sub tab 2, titolo';
$txt['smenu_sub_tab_url2'] = 'Sub tab 2, url';
$txt['smenu_sub_tab_title3'] = 'Sub tab 3, titolo';
$txt['smenu_sub_tab_url3'] = 'Sub tab 3, url';
$txt['smenu_sub_tab_title4'] = 'Sub tab 4, titolo';
$txt['smenu_sub_tab_url4'] = 'Sub tab 4, url';
//End SiteMenu Strings
]]></add>
    </operation>
</file>


Ciao!

Graziano

Afro


Tanks

Hi Tyrrson

Thank you for a very useful mod.

Is it to much hassle to ask you how to prevent guests from seeing this new menu item ?

Cheers,

Tanks

Arantor

To do that, you have to edit Subs.php itself.

Find:
'show' => !empty($modSettings['smenu_enabled']) && !empty($modSettings['smenu_main_tab_title']) && !empty($modSettings['smenu_main_tab_url']),

Replace with:
'show' => $context['user']['is_logged'] && !empty($modSettings['smenu_enabled']) && !empty($modSettings['smenu_main_tab_title']) && !empty($modSettings['smenu_main_tab_url']),


Btw, mod really should use spaces instead of tabs (not sure how I missed that before :S)

Advertisement: