News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Adding website link to smf page?

Started by evilstevie, October 06, 2015, 12:19:10 AM

Previous topic - Next topic

evilstevie

Hello.   I'm looking to add a hyperlink from the SMF main forum page back to a website page.      I had this working a couple of years ago in ver 1.x of smf, but now at ver 2.0.11, I'm no longer able to do this with my very limited skill set.    Thanks for any help.

Very similar to what this guy wanted to do in 2012, but I don't know what smf version was current then.    http://www.simplemachines.org/community/index.php?topic=476927.0

Gluz

http://wiki.simplemachines.org/smf/Buttons_-_How_do_I_add_buttons_to_SMF_2.0

It's all in the wiki, all you need is edit the Subs.php file with the correct data and your are done.

evilstevie

Thanks for the reply.    Not having any luck unfortunately.    Even trying to add a simple "test" button, as below (bold), and I'm not able to make that appear on my forum index.      Ideally, I'd like to be able to place this new button in the upper left corner of the index page, and not with the Home, Help, Search, etc. buttons.     But at this point I can't even add the button anywhere!    Thanks for any 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(
         'home' => array(
            'title' => $txt['home'],
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
            
            ),
         
         'test' => array(
            'title' => $txt['test '],
            'href' => $scripturl . '?action=help',
            'show' => true,
            'sub_buttons' => array(
            ),

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

Kindred

And did you create the Text string that $txt['test'] calls for?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

evilstevie

Quote from: Kindred on October 15, 2015, 10:42:31 PM
And did you create the Text string that $txt['test'] calls for?

Most certainly I did not.

Do I do that in Modifications.YourLangauge.php?

thanks....

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

evilstevie

OK..thanks again.   Making progress here.   I've got the button named, how do I hyperlink that button?
This doesn't work, takes me to xyz.com/smf/h [nofollow] :

'test' => array(
            'title' => $txt['new_button'],
            'href' => $scripturl [www.xyz.com],
            'show' => true,
            'sub_buttons' => array(
            ),

Gluz

The correct syntax for the link is:
'href' => 'http://your.url.here',

$scripturl is a variable that contain the url if the main index.php of the forum, for example http://domain.com/forum/index.php, so, that only can be used when the Button you add have that in the URL so you only add after that some extra parameter, like a direct topic or a separate page managed by SMF or some MOD.

Advertisement: