Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/12/2011, 22:37
Avatar de alette666
alette666
 
Fecha de Ingreso: febrero-2010
Ubicación: En la luna
Mensajes: 277
Antigüedad: 14 años, 3 meses
Puntos: 5
Pregunta mal visualización de emoticones en post de salida PHP

Hola gente yo de nuevo por aca me surgio un nuevo problema (los colaboradores y moderadores "IsaBelM" y "pateketrueke"), me han dado un empujon con ejemplos que podrian solucionar mi problema(y la verdad pude hacer lo que yo tenia pensado), pero en fin aca estoy de nuevo (y si me contesta pateketrueke me vendria de pelos

Bueno al grano: Resulta que he implementado un sistema de frases con emoticones y mysql; en la cual el visitante pincha sobre dicho emoticon y este es insertado en el formulario (textarea); al guardar los datos enviados junto con el texto, los emoticones se guardan en forma de texto tambien. Ahora cuando el visitante hace la consulta de la frase creada recientemente este no se visualiza el emoticon al lado de la frase, sino que se posa abajo; EJEMPLO:

Código:
usuario ingresa:
****
Que calor que hace acá :(
Código:
usuario recibe la consulta y se muestra:
****
Que calor que hace acá
:(
Como verán lo puso abajo del texto y no seguido (y si pongo otro emoticon al lado, este se pone debajo del anterior).

Les paso el código php que hace que se muestre el emoticon en la salida.

config_smile.php
Código PHP:
<?php
// creamos la funcion
if(!function_exists('mostrarCaritas')){
function 
mostrarCaritas($valor){
// la variable $caritas
// guardara como valor
// un array con los posibles caracteres ;)
$caritas = array(
                        
//FILA DE EMOTICONES
"8)",
":s",
"8(",
":|",
":(",
":)",
":D",
"xH",
"CaKe",
"PhO",
"Kiss",
"8>",
">:@",
":O",
":p",
";)",
"d=",
"q=",
"Party",
"|X|",
"Note",
"Sospe",
"Drak",
"Ice",
":@",
"&>",
                            );                
// $imagenes, tambien contendra un array
// con las imagenes que usaremos
$imagenes = array(
                         
//FILA DE EMOTICONES
"<img src='emoticons/e1.gif' height='19'>",
"<img src='emoticons/e2.gif' height='19'>",
"<img src='emoticons/e3.gif' height='19'>",
"<img src='emoticons/e4.gif' height='19'>",
"<img src='emoticons/e5.gif' height='19'>",
"<img src='emoticons/e6.gif' height='19'>",
"<img src='emoticons/e7.gif' height='19'>",
"<img src='emoticons/e16.gif' height='19'>",
"<img src='emoticons/e17.gif' height='19'>",
"<img src='emoticons/e18.gif' height='19'>",
"<img src='emoticons/e19.gif' height='19'>",
"<img src='emoticons/e23.gif' height='19'>",
"<img src='emoticons/e26.gif' height='19'>",
"<img src='emoticons/e8.gif' height='19'>",
"<img src='emoticons/e9.gif' height='19'>",
"<img src='emoticons/e10.gif' height='19'>",
"<img src='emoticons/e11.gif' height='19'>",
"<img src='emoticons/e12.gif' height='19'>",
"<img src='emoticons/e13.gif' height='19'>",
"<img src='emoticons/e14.gif' height='19'>",
"<img src='emoticons/e15.gif' height='19'>",
"<img src='emoticons/e20.gif' height='19'>",
"<img src='emoticons/e21.gif' height='19'>",
"<img src='emoticons/e22.gif' height='19'>",
"<img src='emoticons/e24.gif' height='19'>",
"<img src='emoticons/e25.gif' height='19'>",
                  
                );
// hacemos el reemplazo
            
return (str_replace($caritas$imagenes$valor));
            }
    }
// habilitamos el bufer de salida
    
ob_start("mostrarCaritas");
?>
__________________
Y Sócrates dijo...Solo sé que no sé nada.
Entiende la filosofía como una búsqueda colectiva basada en el diálogo.