I even had to re-register.. aye aye aye!


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"; }