bbCodes for Links bbCodes for 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

bbCodes for Links

Started by brokenclaw, April 03, 2006, 06:37:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brokenclaw

I have successfully installed Coppermine on my site at http://brokenclaw.net/gallery/index.php. I would like to add hyperlinks in the photo descriptions that link back to the associated web page on my site. I have read the Coppermine Photo Gallery v1.4.4: Documentation and Manual, section 4.10. The problem is that the links always open a new window/tab, which I don't think my users would want. Is there any way to code the links in Coppermine to open in the active window?

Joachim Müller

this has been changed in cpg1.4.x - the bbcode links then open in the same window. You're using cpg1.3.5, so you have posted in the wrong section of the board (cpg1.4 (BBS) integration / bridging). Moving your posting accordingly.
To fix your issue, upgrade to cpg1.4.4 or edit include/functions.inc.php, findfunction make_clickable($text)
{
        $ret = " " . $text;
        $ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
        $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
        $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
        $ret = substr($ret, 1);

        return($ret);
}
and replace withfunction make_clickable($text)
{
        $ret = " " . $text;
        $ret = preg_replace("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]+)#i", "\\1<a href=\"\\2://\\3\">\\2://\\3</a>", $ret);
        $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\">www.\\2.\\3\\4</a>", $ret);
        $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
        $ret = substr($ret, 1);

        return($ret);
}
. Then find$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}" target="_blank">{DESCRIPTION}</a></span>';and replace with$bbcode_tpl['url']  = '<span class="bblink"><a href="{URL}">{DESCRIPTION}</a></span>';

brokenclaw

Sorry about the bad placement of my post... I must have been looking at the "Util mod 1.4" version in my Admin Tools.
Thanks for the help. I changed the code as you suggested and it works just fine.