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! :)
Yes.
Bump this thread tomorrow night if nobody else answers you before then.
Thanks...
I'm glad to hear (or read) it's possible. I'll check back tomorrow! :)
Thanks
*bump*
Anyone? Please!!!
include/functions.inc.php
function bb_decode()
find
$patterns[6] = "#\[img\]([a-z]+?://){1}([a-z0-9\-\.,\?!%\*_\#:;~\\&$@\/=\+\(\)]+)\[/img\]#si";
$replacements[6] = $bbcode_tpl['img'];
after that, add a new block
$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>';
Thanks Nibbler..
Almost there.. it worked for 4 out of the 5 websites.
I'm getting some trouble in this one:
//[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?
OK, you'll need to adjust it to accept things other than numbers, eg.
$patterns[11] = "#\[dt\]([a-z0-9-])\[/dt\]#si";
Quote from: Nibbler on February 24, 2007, 01:45:47 AM
OK, you'll need to adjust it to accept things other than numbers, eg.
$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:
//[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:
[dt]computerizedapple-image1937604[/dt]
What am I doing wrong??? :-\
Please... someone has got to know the answer! :-[
Typo.
patterns[11] = "#\[dt\]([a-z0-9-])\[/dt\]#si";
should be
patterns[11] = "#\[dt\]([a-z0-9-]+)\[/dt\]#si";
The plus was missing.
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
Hi!
Tell me please, how add the [size ] [/size] BBcode?
Thanks)
[update] and [align ] [/align] too!
Don't hijack solved threads.