funcion bbcode()
Código PHP:
function bbcode ($texto) {
$texto = str_replace("\n\r","<br>",$texto);
$texto = str_replace("\r\n","<br>",$texto);
$texto = str_replace("\n","<br>",$texto);
$texto = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]", "<a target=\"_blank\" href=\"\\1\">\\2</a>", $texto);
$texto = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a target=\"_blank\" href=\"\\1\">\\1</a>",$texto);
$i=0;
$texto = eregi_replace("\\[u\\]([^\\[]*)\\[/u\\]","<u>\\1</u>", $texto);
$texto = eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<em>\\1</em>", $texto);
$texto = eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<strong>\\1</strong>", $texto);
$texto = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]","<img src=\\1>", $texto);
$texto = preg_replace("/\[code\](.*?)\[\/code\]/e", "showCode('\\1')", $texto);
return $texto;
}
Código PHP:
function showCode($code) {
$html = htmlspecialchars($code, true);
$html = str_replace("\n", "", $html);
$rows = explode("<br />", $html);
$row_num = array();
$i = 1;
foreach($rows as $row) {
if($i < 10) {
$i = "0".$i;
}
if($i==1) {
$row_num[] = "<tr><td><code><font color=\"#000000\"></font>\t$row</code></td></tr>";
}
if($i!=1) {
if(is_int($i/2)) {
$row_num[] = "<tr><td><code><font color=\"#000000\">$i</font>\t$row</code></td></tr>";
} else {
$row_num[] = "<tr><td><code><font color=\"#000000\">$i</font>\t$row</code></td></tr>";
}
}
$i++;
}
return "<pre><b>Codigo:</b></b><table width=450 style=\"border:1px #000000 solid\">".implode($row_num)."</table></pre>";
}
alguien sabe como solucionar esto?
este es un ejemplo d lo q pasa http://newstyle-designs.shinranet.co...cc=vertut&id=8
gracias yoseman por la ayuda