BBCode è un linguaggio utilizzato in molti forum o blog. Se anche voi lo volete applicare sul vostro sito copiate e incollate il seguente codice:
< ?php function BBCode($text) { /** * The following array has the structure Key => Value. The key is the item that will be typed e.g [b] the value will be the html equivilant. */ $BBCode = array("&" => "&", "< " => "<", ">" => ">", "[b]" => "<b>", "[/b]" => "</b>", "[i]" => "<i>", "[/i]" => "</i>", "[u]" => "<u>", "[/u]" => "</u>", "[img]" => "<img src='", "[/img]" =/> "'>"); // Comment Above $parsedtext = str_replace(array_keys($BBCode), array_values($BBCode), $text); //This function will get the input string. and then the keys and values of the array above. It will then replace them with the html equivilant. return $parsedtext; // Return $parsedtext. } //ESEMPIO APPLICATO $text = BBCode("[b][u]HELLO[/u][/b]"); // Execute Function echo $text; // Echo $text. ?>


Leave Your Response