Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/09/2005, 04:35
rockero666
 
Fecha de Ingreso: julio-2004
Mensajes: 51
Antigüedad: 19 años, 9 meses
Puntos: 0
Pregunta funcion bbcode() ayuda

este es el codigo

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

luego la funcion showCode()
Código PHP:
function showCode($code) { 
$html htmlspecialchars($codetrue); 
$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>"

el problema es q no respeta los saltos d linea y si ago uno m sale un <br> y no sale el salto
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