forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: pjoern on September 02, 2004, 01:25:30 pm

Title: Change default target_blank in caption links
Post by: pjoern 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
Title: Re: Change default target_blank in caption links
Post by: Nibbler 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".
Title: Re: Change default target_blank in caption links
Post by: pjoern on September 03, 2004, 09:54:57 am
Just remove the target="_blank".

Thank you!

Jorgen Peter Kjeldsen
Title: Re: Change default target_blank in caption links
Post by: xplicit 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'];