Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/11/2009, 01:15
thezzin
 
Fecha de Ingreso: septiembre-2008
Mensajes: 350
Antigüedad: 15 años, 8 meses
Puntos: 31
Respuesta: Duda sobre sistema bbcode

aquí te dejo

Código PHP:
<?php 
$htmlT 
'[color=#0066FF]Color azul[/color] the <br /> [bg=#0066FF]Color del fondo azul[/bg]
<br /> Texto[b] B[/b] <br /> [size=9]Texto Tama&ntilde;o[/size]
<br /> y Mas Texto aqu [sup]i[/sup]'
;
$buscar = array(
'/\[sup\](.*?)\[\/sup\]/is',
'/\[sub\](.*?)\[\/sub\]/is',
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[img\](.*?)\[\/img\]/is',
'/\[url\](.*?)\[\/url\]/is',
'/\[url\=(.*?)\](.*?)\[\/url\]/is',
'/\[color\=(.*?)\](.*?)\[\/color\]/is',
'/\[bg\=(.*?)\](.*?)\[\/bg\]/is',
'/\[size\=(.*?)\](.*?)\[\/size\]/is',
);
$reemplazar = array(
'<sup>$1</sup>',
'<sub>$1</sub>',
'<b>$1</b>',
'<em>$1</em>',
'<u>$1</u>',
'<img src="$1" alt="" />'
'<a href="$1" target="_blank">$1</a>',
'<a href="$1" target="_blank">$2</a>',
'<font color="$1">$2</font>',
'<span style="background-color: $1">$2</span>',
'<font size="$1">$2</font>',
);
$htmlT preg_replace ($buscar$reemplazar$htmlT);
echo 
$htmlT;
?>

-
__________________
╬-----╬
║☺₧☻║
╬-----╬