[MODDB] Internal Links Open in Same Window (Local Links)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

[MODDB] Internal Links Open in Same Window (Local Links)

Post by drathbun »

The purpose of this MOD is to add a function to bbcode.php that allows users to post links to other posts (or topics) within your forum that reuse the same browser window.

In the standard phpBB code any link - whether it's entered with bbcode URL or simply entered as a web address - will open a new browser window when clicked. This mod adds a function call after all of the other bbcode formatting has been done. At that point the text is just about ready to display. This MOD searches the post text for any URL's that reference your server (as determined by $board_config['server_name']) and changes the target so that internal links reuse your existing browser session.

[Edit]
Added download link
Zip file
txt file

Demo Post with a variety of links to see this MOD in action.

Submitted to the MOD-DB, will update if / when approved.

Approved and in the MOD-DB.
[/Edit]

MOD Release / Support Topic
Last edited by drathbun on Tue Feb 28, 2006 2:04 am, edited 5 times in total.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

An Enhancement Idea

Post by drathbun »

Future Enhancement
It might be nice to make this a user profile setting, something like:

Code: Select all

Internal Links Open in Same Window Yes No
Even if you implement this mod and your users complain that they want the links to open in a new window, there's a very easy fix. At least with IE... simply hold the SHIFT key down while you click and it forces a new browser window to be opened for any link. ;)

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Another option

Post by drathbun »

Note there's another similar mod that changes all links to open in the same window in this topic:

http://www.phpbb.com/phpBB/viewtopic.php?t=36342

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Sample link, and more mods if interested

Post by drathbun »

And finally, here's a link to a forum where you can demo this MOD in action. This is a particular topic, and it's locked, but you can check out the behavior of internal vs. external links.

[Edit]Link updated
Demo Post with a variety of links for testing.
[/Edit]
Last edited by drathbun on Sun Feb 12, 2006 10:52 pm, edited 2 times in total.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

Just curious... is anyone interested in this mod? Has anyone tried it out to see if it works for you?

I did figure out one thing, I should change the hard coding for "http:" to use the board config item in case anyone is running a secure server (https). I should also include the port, in case someone is using a non-standard port.

How about it... has anyone else tried it? Did it work? have problems?

I can't believe I'm the only one that would rather have internal links stay in the same browser window instead of spawning a million new sessions... but maybe that's just me. 8)

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic »

Note, there is also another mod which does this same thing slightly differently here - http://www.phpbb.com/phpBB/viewtopic.php?t=25354

good idea though, i didn't think to use the board name in the config :?
Defend the game:
Image
User avatar
Mav
Former Team Member
Posts: 2261
Joined: Wed May 15, 2002 9:19 am
Location: England
Contact:

Post by Mav »

i've tried it and it seems to be working fine :D

must have missed your version when it came out netclectic
netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic »

[Edit]
Oops! :oops: I take it back, i really shold read through and try the example before opening my mouth ;)
netclectic wrote: It was a while ago, and there wasn't much of a fanfare :wink:

One thing, i dont think this version will work for auto created links, eg www.phpbb.com - without the [ url ] tags. You might want to look at the make_clickable function in bbcode.php :!:

[/Edit]
Defend the game:
Image
User avatar
Mav
Former Team Member
Posts: 2261
Joined: Wed May 15, 2002 9:19 am
Location: England
Contact:

Post by Mav »

just tested it that way and it worked fine 8)
R. U. Serious
Registered User
Posts: 830
Joined: Mon Feb 11, 2002 2:07 pm

Post by R. U. Serious »

What would be nice is, if you follow an internal link it also appends the users session_id (for those not using cookies).

I haven't tried the mod yet, but I certainly will. Good work. :)
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

R. U. Serious wrote: What would be nice is, if you follow an internal link it also appends the users session_id (for those not using cookies).

Oh yeah, supposed to use the append_sid() function for that. Forgot. I'll put it in and test it and update the code. Thanks for the feedback.

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

netclectic wrote: Note, there is also another mod which does this same thing slightly differently here - http://www.phpbb.com/phpBB/viewtopic.php?t=25354

good idea though, i didn't think to use the board name in the config :?

Well, I did search first, apparently not well enough. ;) Also I saw a post from AbelaJohnB that implied that this had not been done before. Or at least that was the way I read it. Was still fun to figure out, and I thought I would share my efforts with my first mod.

Thanks for adding the link; that way folks have options! Always a good thing... :D

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
Percu.org
Registered User
Posts: 88
Joined: Sun Apr 28, 2002 2:54 pm
Location: Valence (France)
Contact:

Post by Percu.org »

this mod works exactly the way i need !

thanks to the Author
User avatar
IDB
Registered User
Posts: 67
Joined: Thu Jan 17, 2002 10:52 pm
Location: Milwaukee, Wi
Contact:

Post by IDB »

drathbun wrote:
R. U. Serious wrote:What would be nice is, if you follow an internal link it also appends the users session_id (for those not using cookies).

Oh yeah, supposed to use the append_sid() function for that. Forgot. I'll put it in and test it and update the code. Thanks for the feedback.

Dave


Did you make this change yet?
Regards, Ian.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun »

IDB wrote: Did you make this change yet?

No, actually, and somehow I didn't get notified of your post. I have this topic set to "watch", but I had assumed that nobody was following it / requesting it since I wasn't getting notified.

I've got some "phpbb-modding" time scheduled soon, primarily for my own board, but I'll try to get the code fixed to use the append_sid() function too.

Thanks for your interest.

Dave
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
Locked

Return to “[2.0.x] MODs in Development”