I made two mods. Open links in new tab bbcode and open links in new tab non-bbcode. I went to reference them today, and they're gone... AHHHH! Help!
I even had to re-register.. aye aye aye!
Open links in new tabs
Forum rules
In order the get any support, you will have to do following:
1. Use a describing title!
2. Describe your problem and what happened when the problem occured
3. Tell us what version of phpBB3 you are currently using.
Else your topic may be ignored or locked!
In order the get any support, you will have to do following:
1. Use a describing title!
2. Describe your problem and what happened when the problem occured
3. Tell us what version of phpBB3 you are currently using.
Else your topic may be ignored or locked!
- Stoker
- Site Admin
- Posts: 3536
- Joined: 12 May 2008, 23:26
- BBCodes: 239
- Favourite BBCode: Anipro
- Favourite MOD: PrettyPhoto
- Location: Denmark
- Contact:
Re: Open links in new tabs
Found some of it here:
Alphahusky » 06 Jun 2009, 02:31 wrote:I know there is a post already about opening links in a new tab, but is is only for the URL bbcode and does not work if someone just types in the the web address without the URL bbcode...
This way will will open links in new tabs without the url bbcode....
(!!PLEASE SEE NEXT POST BEFORE USING THIS CODE. YOU MAY WANT TO USE THE NEXT SET INSTEAD.!! Thank you!)
Open: /includes/functions_content.php
Find:Replace with:Code: Select all
$html = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";
You may need to Purge the cache after doing this....Code: Select all
$html = "$whitespace<!-- $tag --><a$class href=\"$url\" onclick=\"window.open(this.href);return false;\">$text</a><!-- $tag -->$append";
That's it!
and there is a Link in new window bbcode somewhere in the db here.Alphahusky » 06 Jun 2009, 02:50 wrote:Oops... Found a couple of hiccups...
1. Email link opens new tab
2. local links are opened in new tab as well...
I just fixed them though....
I will leave the code above unchanged in case people want it that way.. elsewise, here is the fixed code that will only open external links in new tabs and leave local links and email alone..
Find:Or find (If you used my above code first)Code: Select all
$html = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";
Replace with:Code: Select all
$html = "$whitespace<!-- $tag --><a$class href=\"$url\" onclick=\"window.open(this.href);return false;\">$text</a><!-- $tag -->$append";
Code: Select all
$DoNormal = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append"; if ($type == MAGIC_URL_EMAIL) { $html = $DoNormal; } elseif ($type == MAGIC_URL_LOCAL) { $html = $DoNormal; } else { $html = "$whitespace<!-- $tag --><a$class href=\"$url\" onclick=\"window.open(this.href);return false;\">$text</a><!-- $tag -->$append"; }
Board rules! No PM support