Ajuda com código (problema aspas simples e duplas)

  • Autor Autor Carlos Figueroa
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
Carlos Figueroa

Carlos Figueroa

1
Mi
Social Media
Verificado
Verificación en dos pasos activada
¡Excelente comerciante!
Suscripción a IA
Hola necesito por favor una pequeña ayudita aquí, lo que pasa es que estoy queriendo poner un código de un anuncio para que solo salga en ciertas categorías pero tengo un problema con comillas dobles y simples, tengo entendido que después de
PHP:
echo '
para que no haya un conflicto ahí todo tiene que estar en comillas dobles mi problema esta en que casi todo tiene comillas dobles pero hay cierta parte del código del anuncio que tiene comillas simples y no se como solucionar eso. Haber quien me puede ayudar a corregir eso, o a hacerlo de otra forma. Marcare las partes donde están las comillas simples que hacen dar el error.

Inserir CODE, HTML ou PHP:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
echo '<script>
rm_sid = "PEMSros";
rm_artist = (document.title.match(/(.+) - /) || ["",""])[1].replace("Descargar", "");
rm_song = (document.title.match(/ - (.+)/) || ["",""])[1].replace(/\(.+\)/g, "").replace(/ \| (.+)/g, "");
rm_icon_left = "http://i.imgur.com/ijzFvSI.gif";
rm_icon_right = "http://i.imgur.com/52okisN.gif";
if (rm_song) {
rm_text = "Descarga el Ringtone &quot;" + rm_song + "&quot; a tu Movil";
} else if (rm_artist) {
rm_text = "Descarga tonos de " + rm_artist + " a tu Movil";
} else {
rm_text = "Descarga Ringtones a tu Movil";
}
document.write([COLOR=#ff0000]'[/COLOR]<a href="http://www.ringtonematcher.com/go/?sid=[COLOR=#ff0000]'[/COLOR] + rm_sid + [COLOR=#ff0000]'[/COLOR]&amp;artist=[COLOR=#ff0000]'[/COLOR] + encodeURIComponent(rm_artist)+[COLOR=#ff0000]'[/COLOR]&amp;song=[COLOR=#ff0000]'[/COLOR] + encodeURIComponent(rm_song) + [COLOR=#ff0000]'[/COLOR]" target="_blank" rel="nofollow" style="text-decoration: none; font: bold 14px Arial;"><img src="[COLOR=#ff0000]'[/COLOR] + rm_icon_left + [COLOR=#ff0000]'[/COLOR]" style="border-style: none; vertical-align: bottom;" /> <span style="text-decoration: underline; color: #f00;">[COLOR=#ff0000]'[/COLOR] + rm_text + [COLOR=#ff0000]'[/COLOR]</span> <img src="[COLOR=#ff0000]'[/COLOR] + rm_icon_right + [COLOR=#ff0000]'[/COLOR]" style="border-style: none; vertical-align: bottom;" /></a>[COLOR=#ff0000]'[/COLOR]);
</script>';
} 
?>

O sera que si simplemente cambio las comillas simples por dobles se soluciona?
 
Última edição:
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
copia el siguiente codigo:

HTML:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
echo '<script>
rm_sid = "PEMSros";
rm_artist = (document.title.match(/(.+) - /) || ["",""])[1].replace("Descargar", "");
rm_song = (document.title.match(/ - (.+)/) || ["",""])[1].replace(/\(.+\)/g, "").replace(/ \| (.+)/g, "");
rm_icon_left = "http://i.imgur.com/ijzFvSI.gif";
rm_icon_right = "http://i.imgur.com/52okisN.gif";
if (rm_song) {
rm_text = "Descarga el Ringtone &quot;" + rm_song + "&quot; a tu Movil";
} else if (rm_artist) {
rm_text = "Descarga tonos de " + rm_artist + " a tu Movil";
} else {
rm_text = "Descarga Ringtones a tu Movil";
}
document.write(\'<a href="http://www.ringtonematcher.com/go/?sid=\' + rm_sid + \'&amp;artist=\' + encodeURIComponent(rm_artist)+\'&amp;song=\' + encodeURIComponent(rm_song) + \'" target="_blank" rel="nofollow" style="text-decoration: none; font: bold 14px Arial;"><img src="\' + rm_icon_left + \'" style="border-style: none; vertical-align: bottom;" /> <span style="text-decoration: underline; color: #f00;">\' + rm_text + \'</span> <img src="\' + rm_icon_right + \'" style="border-style: none; vertical-align: bottom;" /></a>\');
</script>';
} 
?>
 
copia el siguiente codigo:

HTML:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
echo '<script>
rm_sid = "PEMSros";
rm_artist = (document.title.match(/(.+) - /) || ["",""])[1].replace("Descargar", "");
rm_song = (document.title.match(/ - (.+)/) || ["",""])[1].replace(/\(.+\)/g, "").replace(/ \| (.+)/g, "");
rm_icon_left = "http://i.imgur.com/ijzFvSI.gif";
rm_icon_right = "http://i.imgur.com/52okisN.gif";
if (rm_song) {
rm_text = "Descarga el Ringtone &quot;" + rm_song + "&quot; a tu Movil";
} else if (rm_artist) {
rm_text = "Descarga tonos de " + rm_artist + " a tu Movil";
} else {
rm_text = "Descarga Ringtones a tu Movil";
}
document.write(\'<a href="http://www.ringtonematcher.com/go/?sid=\' + rm_sid + \'&amp;artist=\' + encodeURIComponent(rm_artist)+\'&amp;song=\' + encodeURIComponent(rm_song) + \'" target="_blank" rel="nofollow" style="text-decoration: none; font: bold 14px Arial;"><img src="\' + rm_icon_left + \'" style="border-style: none; vertical-align: bottom;" /> <span style="text-decoration: underline; color: #f00;">\' + rm_text + \'</span> <img src="\' + rm_icon_right + \'" style="border-style: none; vertical-align: bottom;" /></a>\');
</script>';
} 
?>
Disculpa, me podrias decir que cambiaste por favor? para tenerlo en cuenta para una proxima

---------- Post agregado el 12-abr-2013 hora: 18:07 ----------

Mmm pues ahi ya funciona pero el cambio que hayas hecho me desactivo una funcion, y es que el codigo tiene que coger un nombre deberia de salir ejemplo:

Descarga El Ringtone "Titulo" a tu Movil

y Ahora sale

Descarga Ringtones a tu Movil

Mira un ejemplo en vivo de una web que tiene el código Letras De Psy - Gentleman (Lyrics / Lirica) | FlowHoT.NeT - La Pagina Mas Rankia! y mira un ejemplo de mi web Descargar: Makano – Traicionera (Panama Music) | Descargar Música Gratis, Reggaeton, Rap, Salsa, Noticias, y Mucho Mas! |TRIPEOMUSIC.NET|
 
solo agrege \ antes de las comillas simples, y las comillas simples esta por debajo de tu código del titulo, revisa bien tu código no tiene nada que ver con lo que edite.

checa esta parte del código, rm_song refiere al titulo, seguro ?

HTML:
if (rm_song) {
rm_text = "Descarga el Ringtone &quot;" + rm_song + "&quot; a tu Movil";
} else if (rm_artist) {
rm_text = "Descarga tonos de " + rm_artist + " a tu Movil";
} else {
rm_text = "Descarga Ringtones a tu Movil";
}
 
solo agrege \ antes de las comillas simples, y las comillas simples esta por debajo de tu código del titulo, revisa bien tu código no tiene nada que ver con lo que edite.

checa esta parte del código, rm_song refiere al titulo, seguro ?

HTML:
if (rm_song) {
rm_text = "Descarga el Ringtone &quot;" + rm_song + "&quot; a tu Movil";
} else if (rm_artist) {
rm_text = "Descarga tonos de " + rm_artist + " a tu Movil";
} else {
rm_text = "Descarga Ringtones a tu Movil";
}
Pues segun veo comparando al agregar \ desactivas la funcion que hace ese codigo, porque queda de la manera simple que es Descarga Ringtones A Tu Movil y no le agrega la parte del titulo al codigo.

Edito: Emmm, sorry retiro lo dicho, ya veo que solo pasa ese problema en una sola categoria, y prefiero sacar esa categoria a quitar todo el codigo, Muchas gracias. Me ha servido mucho tu ayuda
 
Última edição:
Prueba asi:

HTML:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
echo "<script>
rm_sid = 'PEMSros';
rm_artist = (document.title.match(/(.+) - /) || ['',''])[1].replace('Descargar', '');
rm_song = (document.title.match(/ - (.+)/) || ['',''])[1].replace(/\(.+\)/g, '').replace(/ \| (.+)/g, '');
rm_icon_left = 'http://i.imgur.com/ijzFvSI.gif';
rm_icon_right = 'http://i.imgur.com/52okisN.gif';
if (rm_song) {
rm_text = 'Descarga el Ringtone &quot;' + rm_song + '&quot; a tu Movil';
} else if (rm_artist) {
rm_text = 'Descarga tonos de ' + rm_artist + ' a tu Movil';
} else {
rm_text = 'Descarga Ringtones a tu Movil';
}
document.write('<a href=\"http://www.ringtonematcher.com/go/?sid=' + rm_sid + '&amp;artist=' + encodeURIComponent(rm_artist)+'&amp;song=' + encodeURIComponent(rm_song) + '\" target=\"_blank\" rel=\"nofollow\" style=\"text-decoration: none; font: bold 14px Arial;\"><img src=\"' + rm_icon_left + '\" style=\"border-style: none; vertical-align: bottom;\" /> <span style=\"text-decoration: underline; color: #f00;\">' + rm_text + '</span> <img src=\"' + rm_icon_right + '\" style=\"border-style: none; vertical-align: bottom;\" /></a>');
</script>";
} 
?>
 
Última edição:
Prueba asi:

HTML:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
echo "<script>
rm_sid = 'PEMSros';
rm_artist = (document.title.match(/(.+) - /) || ['',''])[1].replace('Descargar', '');
rm_song = (document.title.match(/ - (.+)/) || ['',''])[1].replace(/\(.+\)/g, '').replace(/ \| (.+)/g, '');
rm_icon_left = 'http://i.imgur.com/ijzFvSI.gif';
rm_icon_right = 'http://i.imgur.com/52okisN.gif';
if (rm_song) {
rm_text = 'Descarga el Ringtone &quot;' + rm_song + '&quot; a tu Movil';
} else if (rm_artist) {
rm_text = 'Descarga tonos de ' + rm_artist + ' a tu Movil';
} else {
rm_text = 'Descarga Ringtones a tu Movil';
}
document.write('<a href=\"http://www.ringtonematcher.com/go/?sid=' + rm_sid + '&amp;artist=' + encodeURIComponent(rm_artist)+'&amp;song=' + encodeURIComponent(rm_song) + '\" target=\"_blank\" rel=\"nofollow\" style=\"text-decoration: none; font: bold 14px Arial;\"><img src=\"' + rm_icon_left + '\" style=\"border-style: none; vertical-align: bottom;\" /> <span style=\"text-decoration: underline; color: #f00;\">' + rm_text + '</span> <img src=\"' + rm_icon_right + '\" style=\"border-style: none; vertical-align: bottom;\" /></a>');
</script>";
} 
?>
Pues sigue igual amigo, pero para lo que mas me importaba ya me quedo funcionando, para la categoria en que me salia diferente ya le cambie el texto. Muchas gracias
 
con esta me rindo:

prueba:

HTML:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
echo "<script>
rm_sid = \"PEMSros\";
rm_artist = (document.title.match(/(.+) - /) || [\"\",\"\"])[1].replace(\"Descargar\", \"\");
rm_song = (document.title.match(/ - (.+)/) || [\"\",\"\"])[1].replace(/\(.+\)/g, \"\").replace(/ \| (.+)/g, \"\");
rm_icon_left = \"http://i.imgur.com/ijzFvSI.gif\";
rm_icon_right = \"http://i.imgur.com/52okisN.gif\";
if (rm_song) {
rm_text = \"Descarga el Ringtone &quot;\" + rm_song + \"&quot; a tu Movil\";
} else if (rm_artist) {
rm_text = \"Descarga tonos de \" + rm_artist + \" a tu Movil\";
} else {
rm_text = \"Descarga Ringtones a tu Movil\";
}
document.write('<a href=\"http://www.ringtonematcher.com/go/?sid=' + rm_sid + '&amp;artist=' + encodeURIComponent(rm_artist)+'&amp;song=' + encodeURIComponent(rm_song) + '\" target=\"_blank\" rel=\"nofollow\" style=\"text-decoration: none; font: bold 14px Arial;\"><img src=\"' + rm_icon_left + '\" style=\"border-style: none; vertical-align: bottom;\" /> <span style=\"text-decoration: underline; color: #f00;\">' + rm_text + '</span> <img src=\"' + rm_icon_right + '\" style=\"border-style: none; vertical-align: bottom;\" /></a>');
</script>";
} 
?>
 
la diferencia que veo entre ambos post es que el titulo en el que te sale bien no contiene caracteres especiales y en el que sale mal contiene parentesis (caracter especial), posiblemente tu codigo no lo acepte. te sugeriria usar la variable para obtener el titulo en wordpress que es get_the_title();

con esto ya lo tendras hecho 😉

HTML:
<?php if (in_category(array('1477', '16479', '2160', '16', '3573', '37', '26', '25', '33', '31', '18', '9', '28984', '11', '30', '23')) ) {
$newtitle = get_the_title();
$newtitle = str_replace('Descargar','',$newtitle);
echo "<script>
rm_sid = \"PEMSros\";
rm_artist = (document.title.match(/(.+) - /) || [\"\",\"\"])[1].replace(\"Descargar\", \"\");
rm_song = \"";
?>
<?php echo $newtitle; ?>
<?php echo "\";
rm_icon_left = \"http://i.imgur.com/ijzFvSI.gif\";
rm_icon_right = \"http://i.imgur.com/52okisN.gif\";
if (rm_song) {
rm_text = \"Descarga el Ringtone &quot;\" + rm_song + \"&quot; a tu Movil\";
} else if (rm_artist) {
rm_text = \"Descarga tonos de \" + rm_artist + \" a tu Movil\";
} else {
rm_text = \"Descarga Ringtones a tu Movil\";
}
document.write('<a href=\"http://www.ringtonematcher.com/go/?sid=' + rm_sid + '&amp;artist=' + encodeURIComponent(rm_artist)+'&amp;song=' + encodeURIComponent(rm_song) + '\" target=\"_blank\" rel=\"nofollow\" style=\"text-decoration: none; font: bold 14px Arial;\"><img src=\"' + rm_icon_left + '\" style=\"border-style: none; vertical-align: bottom;\" /> <span style=\"text-decoration: underline; color: #f00;\">' + rm_text + '</span> <img src=\"' + rm_icon_right + '\" style=\"border-style: none; vertical-align: bottom;\" /></a>');
</script>";
}
?>
 
Última edição:
Ohh es verdad, lastima no saber de php y esas cosas para hacer que los acepte jeje, pero con tu ayuda me quedo satisfecho porque por lo menos ya no se me traba la pagina al cargarla por esas comillas.
 

Tópicos similares

Voltar
Topo