custom bbcode doesn't work

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
manueru
Registered User
Posts: 1
Joined: Thu Mar 20, 2008 9:34 am

custom bbcode doesn't work

Post by manueru » Thu Mar 20, 2008 9:47 am

I'm trying to add a new bbcode on phpbb 2.0.22 (with multi-bbcode installed) which will work like the img bbcode but using ligthbox (i need keep them as separated bbcodes). The syntax looks like this: [xligthbox]url[/xligthbox]. I modify bbcode.php in this way:

In function prepare_bbcode_template($bbcode_tpl):

After:

Code: Select all

$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img'])

Code: Select all

$bbcode_tpl['xligthbox'] = str_replace('{URL}', '\\1', $bbcode_tpl['xligthbox']);

In function bbencode_second_pass($text, $uid):

After:

Code: Select all

$replacements[] = $bbcode_tpl['img'];

Code: Select all

$patterns[] = "#\[xligthbox:$uid\]([^?](?:[^\[]+|\[(?!url))*?)\[/xligthbox:$uid\]#si";
            $replacements[] = $bbcode_tpl['xligthbox'];
In funtion function bbencode_first_pass($text, $uid):

After:

Code: Select all

$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
$text =

Code: Select all

preg_replace("#\[xligthbox\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/xligthbox\]#sie", "'[xligthbox:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/xligthbox:$uid]'", $text);
At bbcode.tpl, i added:

Code: Select all

<!-- BEGIN xligthbox --><a rel="lightbox" href="{URL}"><img src="{URL}" style="border: 0;" onLoad="if(this.width > 550) {this.width = 550;}" onmouseout="unpointercursor();" onmouseover="if(this.width == 550) {pointercursor();}" /></a><!-- END xligthbox -->
As you can see, i have only duplicated the img lines and changed the img tag by xligthbox tag. But it doesn´t work, and i don't know why becausa i did the same that for img tag.

Any idea?

Thanks a lot

Post Reply

Return to “[2.0.x] MOD Writers Discussion”