Jump to content

Archived

This topic is now archived and is closed to further replies.

DarkendSoul

preg_replace bbcode. code in code...

Recommended Posts

$code = preg_replace("#\[QUOTE\](.*)\[/QUOTE\]#si", "<table id='quote' align='center'><tr><td class='title'>QUOTE </td></tr><tr><td class='body'>\\1</td></tr></table>", $code);

Using the above code, when inputting things like the following:

[ quote] TEXT [ quote] TEXT [ quote] TEXT [ quote] TEXT [/quote] [/quote] [/quote] [/quote]

it will only output

<table id='quote' align='center'><tr><td class='title'>QUOTE </td></tr><tr><td class='body'> TEXT [ quote] TEXT [ quote] TEXT [ quote] TEXT [/quote] [/quote] [/quote] </td></tr></table>

I would like to do like it does in this website and output

[quote] TEXT [quote] TEXT [quote] TEXT [quote] TEXT [/quote] [/quote] [/quote] [/quote]

Share this post


Link to post
Share on other sites
[code]<?php
while(preg_match("#\[QUOTE\](.*)\[/QUOTE\]#si", $code)!=0){
$code = preg_replace("#\[QUOTE\](.*)\[/QUOTE\]#si", "<table id='quote' align='center'><tr><td class='title'>QUOTE </td></tr><tr><td class='body'>\\1</td></tr></table>", $code);
}
?>[/code]

I think this will work :)

Orio.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.