Re: [PHP] Re: Converting HTML to BBCode

2006-03-08 Thread Curt Zirzow
I dont know where this thread came from but... On Mon, Mar 06, 2006 at 12:33:32PM -0700, J_K9 wrote: > ... > ---CODE--- > > $text = $_REQUEST['text']; > > echo ''; > > $translate_array = array( > ... > ''); > > $replace_array= array_values($translate_array); And: $replace_array =

Re: [PHP] Re: Converting HTML to BBCode [SOLVED]

2006-03-07 Thread Rafael
Hi, I'm glad it worked (so far, hehe) Also, there's something I forgot to tell you (though I think you may as well be already doing this): there will be some unknown tags for the to_bbcode() function (even maybe some variations of those that it should recognize but it won't), so you

[PHP] Re: Converting HTML to BBCode [SOLVED]

2006-03-07 Thread J_K9
Hi, Thank you for that - although I do have to admit that I don't understand a single bit of the reg-exp part. :) It is now working flawlessly! Here is the final code I used: ---CODE--- '; /** * Performes BBCode conversion for some simple HTML elements * * @staticvar string

[PHP] Re: Converting HTML to BBCode [medium]

2006-03-06 Thread Rafael
First of all, the back-slashes added before a " character is probably because of the gpc_magic_quotes directive in PHP, wich tries to "escape" the quotes (pretty stupid, if you ask me), so you must have to use strip_slashes() on the string you received, e.g: $text = ''; if ( isset($_POST['

[PHP] Re: Converting HTML to BBCode

2006-03-06 Thread J_K9
Hi Al, Thank you for your reply. I have changed my code to the following: ---CODE--- '; $translate_array = array( '' => '[b]', '' => '[/b]', '' => '[b]', '' => '[/b]', '' => '[i]', '' => '[/i]', '' => '[i]', '' => '[/i]', '' => '[u]', '' => '[/u]', ' '[img]', ' border="0" />' => '[/img]'

[PHP] Re: Converting HTML to BBCode

2006-03-06 Thread Al
Here is an example for you. First make an array like this: $translate_array= array( ' & ' => ' & ', '"&"' => '"&"', 'W&OD' => 'W&OD', '&O'=> '&O', 'M&F' => 'M&F', ); Then use: $find_array= array_keys($translate_array); $replace_array= array_values($translate_array)