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: Add Custom BBCode?!  (Read 6667 times)

0 Members and 1 Guest are viewing this topic.

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Add Custom BBCode?!
« on: February 23, 2007, 12:16:53 am »

Hi.. I'm new with coppermine but I was needing to add a custom BBCode.

For example, I am using it on my personal website where on some photos, I link it to a stockphoto website. So, instead of typing the whole thing, I'd like to do "[stock1]12345678[/stock1]" and it would appear "Buy this image from Stock1", with the link "www.stocksite.com/12345678.php"..

Something like this..

Is that possible (please say yes)??

Thanks in advance for your help, and I hope I posted this in the right section! :)
« Last Edit: February 27, 2007, 04:48:19 pm by GauGau »
Logged

Nibbler

  • Guest
Re: Add Custom BBCode?!
« Reply #1 on: February 23, 2007, 02:09:09 am »

Yes.

Bump this thread tomorrow night if nobody else answers you before then.
Logged

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Re: Add Custom BBCode?!
« Reply #2 on: February 23, 2007, 02:59:13 am »

Thanks...

I'm glad to hear (or read) it's possible. I'll check back tomorrow! :)

Thanks
Logged

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Re: Add Custom BBCode?!
« Reply #3 on: February 23, 2007, 08:47:36 pm »

*bump*

Anyone? Please!!!
Logged

Nibbler

  • Guest
Re: Add Custom BBCode?!
« Reply #4 on: February 23, 2007, 10:03:22 pm »

include/functions.inc.php

function bb_decode()

find

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

after that, add a new block

Code: [Select]
                $patterns[7] = "#\[stock1\](\d+)\[/stock1\]#si";
                $replacements[7] = '<span class="bblink"><a href="http://www.stocksite.com/$1.php" rel="external">Buy this image from Stock1</a></span>';
Logged

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Re: Add Custom BBCode?!
« Reply #5 on: February 24, 2007, 01:31:12 am »

Thanks Nibbler..

Almost there.. it worked for 4 out of the 5 websites.

I'm getting some trouble in this one:

Code: [Select]
//[dt]dreamstime[/dt]
$patterns[11] = "#\[dt\](\d+)\[/dt\]#si";
                $replacements[11] = '<span class="bblink"><b><a href="http://www.dreamstime.com/$1-resi277789" rel="external" target="_blank">Buy this image from Dreamstime</a></b></span>';
(thats the code I used)...

On all other sites, the "$1" was just a number sequence. For this site, it's different. I took a example photo (http://www.dreamstime.com/computerizedapple-image1937604).

On the page, it tells me the File ID, but when I tried it ([dt]1937604[/dt]) I got a "page not found" message. When I try the whole thing (computerizedapple-image1937604), the link doesnt work.
On the page I get "[dt]computerizedapple-image1937604[/dt]" typed out.

PS: The "-resi277789" is a referal link and is supposed to be there, I checked.

I dont know if it's because of the hifen or what, can anyone help me out with this?
Logged

Nibbler

  • Guest
Re: Add Custom BBCode?!
« Reply #6 on: February 24, 2007, 01:45:47 am »

OK, you'll need to adjust it to accept things other than numbers, eg.

Code: [Select]
$patterns[11] = "#\[dt\]([a-z0-9-])\[/dt\]#si";
Logged

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Re: Add Custom BBCode?!
« Reply #7 on: February 24, 2007, 07:17:41 pm »

OK, you'll need to adjust it to accept things other than numbers, eg.

Code: [Select]
$patterns[11] = "#\[dt\]([a-z0-9-])\[/dt\]#si";

Ok... tried that and still happens the same thing.. Might not be the hifen then..

See, this should be the final link:

http://www.dreamstime.com/computerizedapple-image1937604-resi277789 (just an example image, it's not even mine)

And is now set as:
Code: [Select]
//[dt]dreamstime[/dt]
$patterns[11] = "#\[dt\]([a-z0-9-])\[/dt\]#si";
                $replacements[11] = '<span class="bblink"><b><a href="http://www.dreamstime.com/$1-resi277789" rel="external" target="_blank">Buy this image from Dreamstime</a></b></span>';

And on the gallery I typed:

Code: [Select]
[dt]computerizedapple-image1937604[/dt]
What am I doing wrong???  :-\
Logged

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Re: Add Custom BBCode?!
« Reply #8 on: February 26, 2007, 07:04:25 pm »

Please... someone has got to know the answer!  :-[
Logged

Nibbler

  • Guest
Re: Add Custom BBCode?!
« Reply #9 on: February 26, 2007, 07:11:19 pm »

Typo.

Code: [Select]
patterns[11] = "#\[dt\]([a-z0-9-])\[/dt\]#si";
should be

Code: [Select]
patterns[11] = "#\[dt\]([a-z0-9-]+)\[/dt\]#si";
The plus was missing.
Logged

escoces

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • www.danielwiedemann.com
    • Daniel Wiedemann | Portfolio
Re: Add Custom BBCode?!
« Reply #10 on: February 27, 2007, 03:03:11 pm »

Thanks Nibbler...

Worked fine just now! :)

I'll be adding 3 more websites soon so if I have any doubts, I'll just *bump* this same topic with the problem..

If not, thanks again! You are an angel!  :D
Logged

QT

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Add Custom BBCode?!
« Reply #11 on: May 11, 2007, 06:03:40 pm »

Hi!
Tell me please, how add the [size ] [/size] BBcode?

Thanks)
Logged

QT

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Add Custom BBCode?!
« Reply #12 on: May 11, 2007, 06:27:16 pm »

[update] and [align ]  [/align] too!
Logged

Nibbler

  • Guest
Re: Add Custom BBCode?!
« Reply #13 on: May 11, 2007, 07:49:33 pm »

Don't hijack solved threads.
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 21 queries.