Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Change default target_blank in caption links  (Read 3983 times)

0 Members and 1 Guest are viewing this topic.

pjoern

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
    • Danish page about Miskito Indians in Prinzapolka, Nicaragua
Change default target_blank in caption links
« on: September 02, 2004, 01:25:30 pm »

Whenever I add a
Code: [Select]
[URL=......] link in image captions, Coppermine inserts a
Code: [Select]
target_blank into the actual link as it appears on the page.
Is there a way to change that (preferably to remove it)?
I've searched in the documentation and in the forum, but found nothing related to this problem.

Thanks in advance

Jørgen Peter Kjeldsen
« Last Edit: September 03, 2004, 11:20:15 am by GauGau »
Logged

Nibbler

  • Guest
Re: Change default target_blank in caption links
« Reply #1 on: September 02, 2004, 08:32:55 pm »

include/functions.inc.php

Code: [Select]
$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" target="_blank">{DESCRIPTION}</a></span>';
Just remove the target="_blank".
Logged

pjoern

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
    • Danish page about Miskito Indians in Prinzapolka, Nicaragua
Re: Change default target_blank in caption links
« Reply #2 on: September 03, 2004, 09:54:57 am »

Just remove the target="_blank".

Thank you!

Jorgen Peter Kjeldsen
Logged

xplicit

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 214
Re: Change default target_blank in caption links
« Reply #3 on: March 05, 2006, 03:30:21 pm »

Ok I know it's an old article and not recommended to use 1.3.x versions but I thought this might be usefull for somebody so posting it here.

In case you dont want to use all links as external but some internal and some external (read: some in new windows some in the same) you can also add some extra codes to the function bb_decode($text) in your functions.inc.php file.

I used it for a website who wanted to make links to internal thumbnail pages in the same browser (big picture with link) but also used links to other sites which needed to be opened in a new window.

Therefore I coded internal links as
Code: [Select]
[iurl] [/iurl] i stands for internal further the use is the same as
Code: [Select]
[url][/url].

To use this add after :

Code: [Select]
if (!count($bbcode_tpl)) {

                $bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" target="_blank">{DESCRIPTION}</a></span>';
            
this code:

Code: [Select]
$bbcode_tpl['iurl']  = '<span class="bblink"><a href="{URL}" target="_self">{DESCRIPTION}</a></span>';
and after

Code: [Select]
  $patterns[6] = "#\[img\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/img\]#si";
                $replacements[6] = $bbcode_tpl['img'];

the following (in case patterns is allready higher than 6 just count further)

Code: [Select]
$bbcode_tpl['iurl1'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['iurl']);
                $bbcode_tpl['iurl1'] = str_replace('{DESCRIPTION}', '\\1\\2', $bbcode_tpl['iurl1']);

                $bbcode_tpl['iurl2'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['iurl']);
                $bbcode_tpl['iurl2'] = str_replace('{DESCRIPTION}', '\\1', $bbcode_tpl['iurl2']);

                $bbcode_tpl['iurl3'] = str_replace('{URL}', '\\1\\2', $bbcode_tpl['iurl']);
                $bbcode_tpl['iurl3'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['iurl3']);

                $bbcode_tpl['iurl4'] = str_replace('{URL}', 'http://\\1', $bbcode_tpl['iurl']);
                $bbcode_tpl['iurl4'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['iurl4']);

// [iurl]xxxx://www.phpbb.com[/iurl] code..
                $patterns[7] = "#\[iurl\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/iurl\]#si";
                $replacements[7] = $bbcode_tpl['iurl1'];

                // [iurl]www.phpbb.com[/iurl] code.. (no xxxx:// prefix).
                $patterns[8] = "#\[iurl\]([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/iurl\]#si";
                $replacements[8] = $bbcode_tpl['iurl2'];

                // [iurl=xxxx://www.phpbb.com]phpBB[/iurl] code..
                $patterns[9] = "#\[iurl=([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/iurl\]#si";
                $replacements[9] = $bbcode_tpl['iurl3'];

                // [iurl=www.phpbb.com]phpBB[/iurl] code.. (no xxxx:// prefix).
                $patterns[10] = "#\[iurl=([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\](.*?)\[/iurl\]#si";
                $replacements[10] = $bbcode_tpl['iurl4'];

Logged
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.