PDA

View Full Version : standard URL hyperlink opening in same window


Floris
04-04-2005, 10:00 PM
As requested here: standard URL hyperlink opening in same window
http://www.vbulletin.com/forum/showthread.php?t=135315

Just doing a quick browse through includes/functions_bbcodeparse.php makes me think this might just be what that user is looking for: (line 1510)

Download & backup the includes/functions_bbcodeparse.php file and open the file (not the backup of course) and find ..


return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";


The target is set to blank which will make the link open a new window. Remove that and they should open in the same window:


return "<a href=\"$rightlink\">$text</a>";


Save the file when you're done and upload it, replacing the file already there (so overwrite it, don't resume or skip it during upload).

If you're using postcache you might need to rebuild post cache first.

Lionel
04-05-2005, 09:00 AM
I'd love to have that, but for links opening to my site only.

wirewolf
04-05-2005, 11:42 AM
floris, could a conditional statement be added so that any forum internal link (other forum pages) would open in the same window, but that any external link (anyother sites) would open in a new one?
John

Floris
04-05-2005, 12:18 PM
floris, could a conditional statement be added so that any forum internal link (other forum pages) would open in the same window, but that any external link (anyother sites) would open in a new one?
John
What you want is how it works by default with vBulletin 3.0.7

wirewolf
04-05-2005, 12:54 PM
I know by default in Vbull, any standard link (url) in a post will open in a new window. I see by the code you showed that it can be changed to open in the same window.

What I want to know, is there a way to add a conditional statement ( ie in affect, <if "start of url == http://yoursite.com/forum/">then open same window><else />open new window) to the code you showed above, so that any url that links to a forums' internal page will open in the same window as the post is in, but any url in a post that points to an external (non forum page, outside source) would open in a new window?

Examples, these two urls' are in the same post:
This internal forum url (or any other) would open in the same window;
http://shipmodeling.net/vb_forum/articles.php?action=viewarticle&artid=38

This external (non forum page) url would open in a new window;
http://www.google.com/

John

Jenta
04-05-2005, 09:12 PM
What I want to know, is there a way to add a conditional statement ( ie in affect, <if "start of url == http://yoursite.com/forum/">then open same window><else />open new window) to the code you showed above, so that any url that links to a forums' internal page will open in the same window as the post is in, but any url in a post that points to an external (non forum page, outside source) would open in a new window?

good idea, probably need to regular expression?

Floris
04-05-2005, 10:02 PM
I know by default in Vbull, any standard link (url) in a post will open in a new window. I see by the code you showed that it can be changed to open in the same window.

What I want to know, is there a way to add a conditional statement ( ie in affect, <if "start of url == http://yoursite.com/forum/">then open same window><else />open new window) to the code you showed above, so that any url that links to a forums' internal page will open in the same window as the post is in, but any url in a post that points to an external (non forum page, outside source) would open in a new window?

Examples, these two urls' are in the same post:
This internal forum url (or any other) would open in the same window;
http://shipmodeling.net/vb_forum/articles.php?action=viewarticle&artid=38

This external (non forum page) url would open in a new window;
http://www.google.com/

John
If you know the post or thread id, use those bbcodes? [thread] ... & [post]...

frankenberrie
04-05-2005, 11:38 PM
Ive already done this but didnt share... Im sorry!