News:

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

Main Menu

New button opened in a new tab

Started by mtmd, June 18, 2013, 07:52:32 AM

Previous topic - Next topic

mtmd

Hi,
I would like to know how can I add a new button, near "Reply", "Add Poll", etc.., that open a new tab or a popup. I've modified $normal_buttons, adding a new line and now the new button it's shown, but the link is opened in the same tab :/ how can i do?
Thank you :)

ps. Sorry for my poor english!

kat

To open a new tab, I believe you need the target="_blank" thing, like this:

<a href="http://www.someurlcom/" target="_blank">Button text</a>

and your English is fine! :)

Kays

Hi, welcome to SMF. :)

To be more precise, add the following to 'url'


" target="_blank


So like for the "print" button, it would be done like this:


'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank'),

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods


Kays

No problem. Since the url is in an array it's not quite done in the conventional manner.

mtmd, if you do have any difficulties, please post the code you have added. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

mtmd

It's perfect! It works! :D
Thank you! :)

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: