Change default target_blank in caption links Change default target_blank in caption links
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Change default target_blank in caption links

Started by pjoern, September 02, 2004, 01:25:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pjoern

Whenever I add a [URL=......] link in image captions, Coppermine inserts a 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

Nibbler

include/functions.inc.php

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

Just remove the target="_blank".

pjoern


xplicit

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 [iurl] [/iurl] i stands for internal further the use is the same as [url][/url].

To use this add after :

if (!count($bbcode_tpl)) {

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

            
this code:

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

and after

  $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)

$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'];


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.