November 1, 200817 yr Hey people ! I'd like to make some BBcode options for the shoutbox on my page ( like to be able to use smilies, write text in any color, bold text, italic text etc ), but I don't know how ! I searched for "How to bbcode shoutbox", "How to make bbcode for shoutbox", "shoutbox bbcode php" and stuff like that in Google, but didn't find anything. I guess it should work like for Bulletin Boards, BBcode is converted to HTML, but how ? Please help me, I'd appreciate it ! Cheers, Revs.
November 2, 200817 yr You can use a variety of functions, the most common are str_ireplace and preg_replace. I'll do a str_ireplace() example. The function stands for string case-insensitive replace and it does exactly what it says on the tin. <?php $form1=$_POST['form']; echo str_ireplace("find","replace",$form1); ?> Here's an example using arrays: <?php $find=array("find","find1"); $replace=array("replace","replace1"); $search="find find1"; echo str_ireplace($find,$replace,$search); ?>
November 2, 200817 yr what he said, so just change the variables to be the input from the user... www.php.net is very helpful for finding out about different functions which are available to you out of the box with php installs
Create an account or sign in to comment