Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/12/2009, 13:56
underworf
 
Fecha de Ingreso: diciembre-2009
Mensajes: 108
Antigüedad: 14 años, 4 meses
Puntos: 0
Warning: preg_replace() [function.preg-replace]: Unknown modifier '\'

ayuda amigos

no entiendo el por que de este error
Warning: preg_replace() [function.preg-replace]: Unknown modifier '\' in C:\AppServ\www\basic\leer.php on line 40
Código:
<?php


function bbcode($text){ 
   $a = array( 
      "/\[i\](.*?)\[\/i\]/is", 
      "/\[b\](.*?)\[\/b\]/is", 
      "/\[u\](.*?)\[\/u\]/is", 
	  "/\[s\](.*?)\[\/s/\]/is",
	  "/\[center\](.*?)\[\/center\]/is",
	  "/\[align=left\](.*?)\[\/align\]/is",
	  "/\[align=right\](.*?)\[\/align\]/is",
      "/\[img\](.*?)\[\/img\]/is", 
	  "/\[img=(.*?)\]/is", 
      "/\[youtube\](.*?)\[\/youtube\]/is", 
      "/\[url=(.*?)\](.*?)\[\/url\]/is",
	  "/\[url\](.*?)\[\/url\]/is",
	  "/\[quote\](.*?)\[\/quote\]/is",
	  "/\[code\](.*?)\[\/code\]/is"
   ); 
   $b = array( 
      "<i>$1</i>", 
      "<b>$1</b>", 
      "<u>$1</u>", 
	  "<strike>$1</strike>",
	  "<p align=\"center\">$1</p>",
	  "<p align=\"left\">$1</p>",
	  "<p align=\"right\">$1</p>",
      "<img src=\"$1\" />", 
	  "<img src=\"$1\" />", 
	  "<object width=\"425\" height=\"344\"><param name=\"movie\" value=\"$1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"$1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed></object>", 

      	"<a href=\"$1\" target=\"_blank\">$a</a>",
      	"<a href=\"$1\" target=\"_blank\">$b</a>",
		"<div class=\"textoCita\">Cita:\n<div class=\"cita\">$1</div></div>",
		"<div class=\"textoCodigo\">C&oacute;digo:\n<div class=\"codigo\">$1</div></div>"
   ); 
   $text = str_replace("<br \>","\n",$text);
   $text = str_replace("watch?v=","v/",$text);
   $text = preg_replace($a,$b, $text); 
   return $text; 
} 
?>
<html>
<head>
<title>Leer noticia - BasicNews</title>
<link href="include/css.css" type="text/css" rel="stylesheet" />
</head>
<body>
<?php

require("include/conexion.php");
if (isset($_GET['ID'])) {
$ID = $_GET['ID'];
//cogemos datos de la base
$select = mysql_query("select * from not_bn where ID = $ID order by ID desc", $conectar)or die("Fallo el select: ".mysql_error());
//los mostramos
while($not = mysql_fetch_array($select)){
//Mostramos el titulo de la noticia
echo "<h1 style=\"text-transform:uppercase;margin-bottom:2px;margin-top:0px;\">".$not['titulo']."</h1>";
//mostramos el contenido de la noticia
echo bbcode(nl2br(htmlspecialchars($not['noticia'])))."";
echo "<p>";
// la fecha y otros datos
echo "Enviado el ".$not['fecha']." a las ".$not['hora']."";
}
}else{
echo "Error!";
}
?>
</body
></html>:'(