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 =
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
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
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['
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]'
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)
6 matches
Mail list logo