lil help with this bb code

Discussion in 'PHP' started by Dirty-Rockstar, Sep 1, 2007.

  1. #1
    I hope i put this in the right spot. I Figured this out before but I cannot seem to get it now. and im already frusterated enough. code was lost when server crashed bla bla....

    anyway...

    
    
    $bb_search = array(
    
    '/\[color\=red\](.*?)\[\/color\]/is'
    
    
    );
    
    $bb_replace = array(
    
    '<font color='#FF0000'>$1</font>'
    
    );
    
    
    PHP:
    I cant seem to get the bb code to print red text. it either goes blank or just prints the bb code as regular text. It has to do with that darn = sign somehow and a slash. like i said i got it before but i cant seem to muddle with it this round

    thanks for your help in advance
     
    Dirty-Rockstar, Sep 1, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Do you just want to allow red or do you want to make a special pattern for each color?

    You could do something like this:
    
    $bb_search = array(
        '/\[color\=([a-z\s]+)\](.*?)\[\/color\]/is'
    );
    
    $bb_replace = array(
        '<font color="$1">$2</font>'
    );
    
    PHP:
     
    nico_swd, Sep 2, 2007 IP