2006-05-24, 05:04 AM
2006-05-24, 05:14 AM
Change doshorturl inside of inc/functions_post.php. In MyBB 1.1.2 (the most recent version), all links are targeted to _blank. If you only want external links to open new windows, you have to parse_url paying attention to the host portion of the result.
2006-05-24, 05:25 AM
Wow. I appreciate your help, but I'm not sure what you're referring to. I'm quite rusty on my programming. I found this, but what do I change?
function doshorturl($url, $name="")
{
$fullurl = $url;
// attempt to make a bit of sense out of their url if they dont type it properly
if(strpos($url, "www.") === 0)
{
$fullurl = "http://".$fullurl;
}
if(strpos($url, "ftp.") === 0)
{
$fullurl = "ftp://".$fullurl;
}
if(strpos($fullurl, "://") === false)
{
$fullurl = "http://".$fullurl;
}
if(!$name)
{
$name = $url;
}
$name = stripslashes($name);
$url = stripslashes($url);
$fullurl = stripslashes($fullurl);
if($name == $url)
{
if(strlen($url) > 55)
{
$name = substr($url, 0, 40)."...".substr($url, -10);
}
}
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
return $link;
}
2006-05-24, 06:34 AM
By default any link in any posted in mybb opens in a new window.
However if we understood you right and you want only external links to open in a new window. then try this
above
add
regards
However if we understood you right and you want only external links to open in a new window. then try this
above
$link = "<a href=\"$fullurl\" target=\"_blank\">$name</a>";
add
if(strstr($fullurl,$mybb->settings['bburl']))
{
$target = "_self";
} else {
$target = "_blank";
}
now change target=\"_blank\" to target=\"$target\"regards
2006-05-24, 12:30 PM
zaher1988 Wrote:By default any link in any posted in mybb opens in a new window.
Yes, it appears that links posted on the site open externally, which is fine.
I only want to add the external links section of the forum to open in a new window. I'm referring to the links that look like forums, but take you to another page when you click them.
2006-05-24, 06:53 PM
Aha then you want the forum that has external link to load in a new window!! ok.
open ./index.php
find
replace with
Now in the Admin CP >Templates > Modify / Delete > Expand > Forumbit templates > forumbit_depth2_forum
find
replace with
regards
open ./index.php
find
$threads = "-";
}
else
{
$posts = mynumberformat($forum['posts']);
replace with
$threads = "-";
$target = "_blank";
}
else
{
$target = "_self";
$posts = mynumberformat($forum['posts']);
Now in the Admin CP >Templates > Modify / Delete > Expand > Forumbit templates > forumbit_depth2_forum
find
<a href="forumdisplay.php?fid=$forum[fid]">
replace with
<a href="forumdisplay.php?fid=$forum[fid]" target="$target">
regards
2006-05-24, 07:15 PM
Works perfectly, thanks!
2006-06-01, 05:18 AM
Ok, one more... What about Subforums that link externally? I imagine the above code would work with small modifications.
2006-06-01, 10:14 AM
I guess you will only need to do what you have dont to the forumbit_depth2_forum template but this time edit forumbit_depth3
regards
regards
2008-09-08, 02:34 PM
(2006-05-24, 06:53 PM)zaher1988 Wrote: [ -> ]Aha then you want the forum that has external link to load in a new window!! ok.
open ./index.php
find
$threads = "-"; } else { $posts = mynumberformat($forum['posts']);
replace with
$threads = "-"; $target = "_blank"; } else { $target = "_self"; $posts = mynumberformat($forum['posts']);
Now in the Admin CP >Templates > Modify / Delete > Expand > Forumbit templates > forumbit_depth2_forum
find<a href="forumdisplay.php?fid=$forum[fid]">
replace with<a href="forumdisplay.php?fid=$forum[fid]" target="$target">
regards
I can't find this code in index.php...