Log in

View Full Version : Forum link - target="_blank"


albibak
10-20-2005, 11:56 AM
Hello,

I created a forum, with the option forum link. It's a link for another website.
When I click on this link, the other website opens in the current window. However I would like to know how I can get it to open in a new window (i.e. target="_blank")

Thanks for your answer.

HiDeo
10-21-2005, 10:42 AM
Same problem on my test forum, no idea !!

Marco van Herwaarden
10-21-2005, 07:28 PM
It is done by a piece in global.php:
// ################################################## ###########################
// Redirect if this forum has a link
// check if this forum is a link to an outside site
if (trim($foruminfo['link']) != '')
{
// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($forumid);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission();
}
exec_header_redirect($foruminfo['link'], true);
}

I don't have time to look for a solution now, but this should get you going.

1 Thing is strange though (a bug??), it is passing a second parameter to exec_header_redirect (true), but this function don't take a second parameter i think.

Paul M
10-21-2005, 08:48 PM
You would need to completely change the way it works, at the moment it sends an http 301 response back to re-direct the browser to the new location, hence it will not (and cannot) open a new page.

albibak
10-29-2005, 08:40 AM
I don't understand :s

harmor19
10-29-2005, 09:06 AM
I guess you can make your own function if that is an internal function.

just change it to
link_redirect($foruminfo['link']);

then add this in global
function link_redirect($link)
{
global $foruminfo;

echo "<a href='$link' target='_blank'>".$foruminfo['name']."</a>";
}


I'm not sure "$foruminfo['name']" is correct.
I'm also not sure if that will work.

mhackl
02-02-2009, 07:29 PM
This would appear to do it for all of the links, but what if you wanted to select the link target per forum?

ragtek
02-02-2009, 07:40 PM
As Marco said, this is a piece of code in global.php and not a function;)

And, target="_blank" is no valid attribut in xhtml ;) it's working, but not valid!