View Single Post
Old 12-09-2008, 06:11 PM   #27 (permalink)
Evulness
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

Using the tutorial at the begining of this topic, i created the following:

Code:
function bbcode($input){

        $code = array('/\[b\](.*?)\[\/b\]/is',
                       '/\[i\](.*?)\[\/i\]/is',
                       '/\[u\](.*?)\[\/u\]/is',
                       '/\[url=(.*?)\](.+?)\[\/url\]/is',
                       '/\[quote\](.*?)\[\/quote\]/is',
                       '/\[color=(.*?)\](.*?)\[\/color\]/is');

        $replace = array('<strong>$1</strong>',
                      '<i>$1</i>',
                      '<u>$1</u>',
                      '<a href="$1">$2</a>',
                      '<br /><div class="quote">$1</div><br />',
                      '<span style="color: $1;">$2</span>');

        $text = preg_replace($code, $replace, $input);

     return $text;

}
echo bbcode('This is a [b]test[\b].');
It isn't replacing anything. Anyone mind poking around a bit and seeing what the issue is?

Thanks.
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote