News:

Join the Facebook Fan Page.

Main Menu

2 Home Buttons

Started by S.T.A.R.S, July 07, 2011, 07:07:48 PM

Previous topic - Next topic

S.T.A.R.S

Is there any possibility of two home buttons. Maybe one of "Website" and one of "Home or Forum"?

Thanks
Currently Developing a Gaming Site and Forum. Providing forums for all gamers around the world to socialise and dicuss with others. We support all genres of games!

Currently underdevelopment!

Need any Website Based help? PM me on Facebook

PM Me for Details, in need of sensible reliable moderators.

DxXCory

You can do that (the easy way) by installing the 6 Custom Tabs mod. You can find it by going to the mod site. :D

Sir Osis of Liver


It's a simple edit in /Sources/Subs.php.  Find the button array, copy the code to add a button, substitute your url and title.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

hcfwesker

I was also wondering this, but how would you substitue a hard link, where it usually says href=> scriptural?   in subs.php

mashby

So this would be the forum URL:
'href' => $scripturl,
I think you can hardcode your site URL something like this:
'href' => 'http://www.yoursite.com/',I think that will work out assuming you change the actual destination.
Always be a little kinder than necessary.
- James M. Barrie

Sir Osis of Liver


Ok, in /Sources/Subs.php, you find this:



// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),




Copy this where you want the new button:



'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),




...and change it to this:



'google' => array(
'title' => 'Google',
'href' => 'http://www.google.com' . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),



If you don't see the new button, comment out this line until you're done:



// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
// if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

hcfwesker

Quote from: mashby on July 08, 2011, 12:02:06 AM
So this would be the forum URL:
'href' => $scripturl,
I think you can hardcode your site URL something like this:
'href' => 'http://www.yoursite.com/',I think that will work out assuming you change the actual destination.

I tried that before, but I forgot the comma on the end.  I suck lol

thanx for your help, bud.

Matthew K.

I wrote a mod for this? Customizable Home Button. Exactly what you guys are looking for, with no edits necessary.

S.T.A.R.S

Mods do not work on my SMF, never have, never will.

Also, i edited the Subs.php but i get given an error within this code after inserting  a new link, but i cant seem to find the errors, anyone help?

// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'website' => array(
'title' => $txt['Website'],
'href' => http://www.mmogamer.co.uk . '?action=help',
'show' => true,
'sub_buttons' => array(
),
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
Currently Developing a Gaming Site and Forum. Providing forums for all gamers around the world to socialise and dicuss with others. We support all genres of games!

Currently underdevelopment!

Need any Website Based help? PM me on Facebook

PM Me for Details, in need of sensible reliable moderators.

Illori

'href' => http://www.mmogamer.co.uk . '?action=help',

should be
'href' => $scripturl . '?action=help',

or i think

'href' =>http://www.mmogamer.co.uk, might work although i did not test that one.

S.T.A.R.S

Currently Developing a Gaming Site and Forum. Providing forums for all gamers around the world to socialise and dicuss with others. We support all genres of games!

Currently underdevelopment!

Need any Website Based help? PM me on Facebook

PM Me for Details, in need of sensible reliable moderators.

Matthew K.

The href for your website button needs to be in single quotes.

S.T.A.R.S

Sorry, what do you mean?

thanks
Currently Developing a Gaming Site and Forum. Providing forums for all gamers around the world to socialise and dicuss with others. We support all genres of games!

Currently underdevelopment!

Need any Website Based help? PM me on Facebook

PM Me for Details, in need of sensible reliable moderators.

Matthew K.

Code (Find) Select
'website' => array(
'title' => $txt['Website'],
'href' => http://www.mmogamer.co.uk, . '?action=help',
'show' => true,
'sub_buttons' => array(
),

Code (Replace) Select
'website' => array(
'title' => $txt['Website'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),

S.T.A.R.S

Ok thanks.

I've added it to my code. Overall it is :

// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'website' => array(
'title' => $txt['Website'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),


When i visit my site of www.mmogamer.co.uk/forum . No "website" button is on the navigation bar :(

thanks for ur help
Currently Developing a Gaming Site and Forum. Providing forums for all gamers around the world to socialise and dicuss with others. We support all genres of games!

Currently underdevelopment!

Need any Website Based help? PM me on Facebook

PM Me for Details, in need of sensible reliable moderators.

Matthew K.

Did you add the text string $txt['Website'] to a language file? You can't just expect text to show up if you don't define it...

S.T.A.R.S

Ah right  :P

First time using these language files, which one is it which i edit? What code do i insert?

Thanks for ur help i appreciate it :)
Currently Developing a Gaming Site and Forum. Providing forums for all gamers around the world to socialise and dicuss with others. We support all genres of games!

Currently underdevelopment!

Need any Website Based help? PM me on Facebook

PM Me for Details, in need of sensible reliable moderators.

Matthew K.

Well, it's probably best to put it in Modifications.english.php

Just add
$txt['Website'] = 'Website';

Sir Osis of Liver


Just copy the code for the Google button I posted above and change the name and url.  You can either use a variable without single quotes, or the actual url and name in quotes, but won't work if you mix them.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Matthew K.

Krash. - Addressing some flaws I see in your code...

First off, why in the world would you do this...
'href' => 'http://www.google.com' . '?action=help',
There is absolutely no need to have ' . '.

Furthermore, if they can't see the button, why comment out caching? That would also throw an error because you didn't comment out the closing if statement bracket, meaning there'll be a floating closing bracket that doesn't link to anything.

If they can't see the button? Use maintenance to clear the file cache, or just change the cache level to 1 or 2. As the menu is only cached on cache level 3.

Advertisement: