
05/07/2006, 12:59
|
| | Fecha de Ingreso: septiembre-2003 Ubicación: lima
Mensajes: 378
Antigüedad: 21 años, 5 meses Puntos: 0 | |
formatear resultado de palabra buscada Hola amigos alguien que me pueda ayudar:
Lo que kiero hacer es darle formato de color a la palabra que busco desde un buscador que hize por ejemplo.
Mi buscador trabaja asi si busco la palabra cusco como resultado me vota esto:
Heart of the Inca
Cusco is considered the most impressive pre-conquest city in the Americas and Machu Picchu the eighth wonder of the world. is considered the most impressive pre-conquest city in the Americas and Machu Picchu the eighth wonder of the world.
pero lo q kiero es darle formato de color a la palabra buscada en este caso cusco de hacer eso deberia de salir asi:
Heart of the Inca Cusco is considered the most impressive pre-conquest city in the Americas and Machu Picchu the eighth wonder of the world. is considered the most impressive pre-conquest city in the Americas and Machu Picchu the eighth wonder of the world.
Estoy probando hacerlo con la funcion eregi_replace() de esta manera
while ($FILA=mysql_fetch_array($RESULTADO)){
echo "<tr><td>"."<a href='verarticulo.php?id=".$FILA['idart']."'>".$FILA['titulo']."<a/>"."<br>";
echo eregi_replace($buscar, '<b>'.$FILA["sumilla"].'</b>' ,$FILA["sumilla"])."<br><br></td>";
}
ahi trato de darle negritas a la palabra buscada pero me sale esto:
Heart of the Inca Cusco is considered the most impressive pre-conquest city in the Americas and Machu Picchu the eighth wonder of the world. is considered the most impressive pre-conquest city in the Americas and Machu Picchu the eighth wonder of the world.
Como pueden ver da el formato de negrita pero busca a la palabra en todo un parrafo y solo kiero q salga en negritas la palabra buscada en este caso "cusco".
Gracias por su ayuda de antemano |