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--- ?php $text = $_REQUEST['text']; echo 'br /br /'; $translate_array = array( ... 'a href=' = '[url=', '/a' = '[/url]', ... ); $find_array=

[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--- !-- Note - input textarea and submit button already coded here in XHTML -- ?php $text = ''; if (

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

2006-03-06 Thread Al
Here is an example for you. First make an array like this: $translate_array= array( ' ' = ' amp; ', '' = 'amp;', 'WOD' = 'Wamp;OD', 'O'= 'amp;O', 'MF' = 'Mamp;F', ); Then use: $find_array= array_keys($translate_array); $replace_array=

[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--- ?php $text = $_REQUEST['text']; echo 'br /br /'; $translate_array = array( 'strong' = '[b]', '/strong' = '[/b]', 'b' = '[b]', '/b' = '[/b]', 'em' = '[i]', '/em' = '[/i]', 'i' = '[i]', '/i' = '[/i]',

[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 (