Jump to content


Photo

html to BBCode


  • Please log in to reply
1 reply to this topic

#1 dedart

dedart
  • Members
  • PipPip
  • Member
  • 10 posts
  • LocationNewcastle Australia

Posted 23 April 2006 - 05:59 AM

Hi, I have a script where I am converting html back to BBCODE for editing and I am having trouble with certain parts of the script

$patterns = array ( "|\<b\>(.*?)\</b\>|s",
                    "|\<i\>(.*?)\</i\>|s",
                    "|\<u\>(.*?)\</u\>|s",
                    "|\<strike\>(.*?)\</strike\>|s",
                    "|\<div style=\"font-size: 14px; color=:#E1B500;\"\>\<b\>QUOTE:\</b\>\</font\>\<div style=\"border: 1px; border-style: solid; background-color: #FFF0B3;\"\>(.*?)\</div\>\</div\>|s");

$replacements = array ( "[ B]\$1[ /B]",
                        "[ I]\$1[ /I]",
                        "[ U]\$1[ /U]",
                        "[ STRIKE]\$1[ /STRIKE]",
                        "[ QUOTE]\$1[ /QUOTE]");

If I have a html string like: <div style="font-size: 14px; color=:#E1B500;"><b>QUOTE:</b></font><div style="border: 1px; border-style: solid; background-color: #FFF0B3;">SOME TEXT</div></div>

The page will output: [ B]QUOTE:[ /B]
SOME TEXT

I have tried re-arranging the arrays and even adding the bbcode bolds to the html string but nothing seems to be working
CAN SOMEONE PLEASE HELP ME, IT'S DRIVING ME CRAZY

dedart

#2 dedart

dedart
  • Members
  • PipPip
  • Member
  • 10 posts
  • LocationNewcastle Australia

Posted 24 April 2006 - 05:10 AM

Anyone help?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users