Foros del Web » Programando para Internet » PHP »

Unexpected T_STRING, expecting ',' or ';'

Estas en el tema de Unexpected T_STRING, expecting ',' or ';' en el foro de PHP en Foros del Web. este es el error que me da: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in wamp\www\eregi.php on line 62 mi codigo es: ...
  #1 (permalink)  
Antiguo 08/10/2009, 20:28
 
Fecha de Ingreso: julio-2008
Mensajes: 10
Antigüedad: 15 años, 9 meses
Puntos: 0
Unexpected T_STRING, expecting ',' or ';'

este es el error que me da:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in wamp\www\eregi.php on line 62

mi codigo es:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = 

(img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
<body>
<?php
$vor 
"eregi.php";
$var $_SERVER['REQUEST_URI'];
if(
eregi($vor$var)) {
echo 
"<div id="Layer10" style="position:absoluteleft:209pxtop:53pxwidth:92pxheight:31pxz-index:10"> <img name="boton1" src="imagenes/boton1.gif" width="93" height="31" border="0" alt=""></div>" ;
}
else {
echo 
"<div id="Layer10" style="position:absoluteleft:209pxtop:53pxwidth:92pxheight:31pxz-index:10"> 

  <a href="
index" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup

('over','boton1','imagenes/boton1_a2.gif','imagenes/boton1.gif',2)" onClick="MM_nbGroup

('down','navbar2','boton1','imagenes/boton1_a2.gif',1)"><img name="boton1" src="imagenes/boton1.gif

width="
93" height="31" border="0" alt=""></a></div>";
}
?>
</body>
</html>
Lo que intento hacer es un boton dinamico, se quede estacionado en el onclick, no lo logre hacer con javascript por lo cual opte por utilizar php, mi codigo php revisa la url en la que uno se encuentra y la compara con la url que yo le indique, si esta tiene parecido mostrara el boton presionado, si no lo tiene el boton seguira dinamico y de nuevo se podra hacer mouseover.

La linea que me da error seria esta
Código PHP:
echo "<div id="Layer10" style="position:absoluteleft:209pxtop:53pxwidth:92pxheight:31pxz
  #2 (permalink)  
Antiguo 08/10/2009, 20:33
Avatar de loncho_rojas
Colaborador
 
Fecha de Ingreso: octubre-2008
Ubicación: En el mejor lugar del mundo
Mensajes: 2.704
Antigüedad: 15 años, 5 meses
Puntos: 175
Respuesta: [Ayuda]Unexpected T_STRING, expecting ',' or ';'

Prueba reemplazar estas lineas, pues tienes problemas de comillas..
Código PHP:
if(eregi($vor$var)) {
echo 
"<div id='Layer10' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:10'> <img name="boton1" src="imagenes/boton1.gif" width="93" height="31" border="0" alt=""></div>" ;
}
else {
echo 
"<div id='Layer10' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:10'> 

  <a href='index' onMouseOut='MM_nbGroup('out');' onMouseOver='MM_nbGroup

('over','boton1','imagenes/boton1_a2.gif','imagenes/boton1.gif',2)' onClick='MM_nbGroup

('down','navbar2','boton1','imagenes/boton1_a2.gif',1)'><img name='boton1' src='imagenes/boton1.gif' 

width='93' height='31' border='0' alt=''></a></div>"
;
}
?> 
__________________
Ayudo con lo que puedo en el foro, y solo en el foro.. NO MENSAJES PRIVADOS.. NO EMAILS NI SKYPE u OTROS.

Antes de hacer un TOPICO piensa si puedes hallarlo en Google o en el Buscador del Foro...
  #3 (permalink)  
Antiguo 08/10/2009, 21:13
 
Fecha de Ingreso: julio-2008
Mensajes: 10
Antigüedad: 15 años, 9 meses
Puntos: 0
El codigo php va de maravilla, pero ahora es el onMouseOver

Gracias por tu respuesta tan rapida me sirvio de mucho.
Pero ahora tengo otro problema, ya no seria con php sino con el onMouseOver

Código PHP:
<?php
$vor 
"anime.php";
$var $_SERVER['REQUEST_URI'];
if(
eregi($vor$var)) {
echo 
"<div id='Layer10' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:10'><img name='boton2' src='imagenes/boton1_a2.gif' width='93' height='31' border='0' alt=''></div>" ;
}
else {
echo 
"<div id='Layer11' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:11'> 

  <a href='eregi.php' onMouseOut='MM_nbGroup('out');' onMouseOver='MM_nbGroup

('over','boton1','imagenes/boton1_a2.gif','imagenes/boton1.gif',2)' onClick='MM_nbGroup

('down','navbar2','boton1','imagenes/boton1_a2.gif',1)'><img name='boton1' src='imagenes/boton1.gif' 

width='93' height='31' border='0' alt=''></a></div>"
;
}
?>
Alguien me puede decir por que l onmouseover ya no sirve? que tendria que hacer para que funcione de nuevo?
  #4 (permalink)  
Antiguo 09/10/2009, 00:22
Avatar de eits  
Fecha de Ingreso: junio-2005
Ubicación: valladolid, yucatán
Mensajes: 1.655
Antigüedad: 18 años, 9 meses
Puntos: 88
Respuesta: [Ayuda]Unexpected T_STRING, expecting ',' or ';'

hay que escapar la comillas que queden dentro de otras comillas
Código PHP:
echo "<div id='Layer11' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:11'><a href='eregi.php' onMouseOut='MM_nbGroup(\'out\');' onMouseOver='MM_nbGroup(\'over\',\'boton1\',\'imagenes/boton1_a2.gif\',\'imagenesboton1.gif\',2)' onClick='MM_nbGroup(\'down\',\'navbar2\',\'boton1\',\'imagenes/boton1_a2.gif\',1)'><img name='boton1' src='imagenes/boton1.gif' width='93' height='31' border='0' alt=''></a></div>";

saludos
__________________
El amor es la locura mas lucida que tiene el hombre.- Andres Henestrosa
la tristeza no existe, solo es... la ausencia de la felicidad.
  #5 (permalink)  
Antiguo 09/10/2009, 00:48
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: [Ayuda]Unexpected T_STRING, expecting ',' or ';'

COMO: usar las comillas bien
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #6 (permalink)  
Antiguo 09/10/2009, 05:28
 
Fecha de Ingreso: julio-2008
Mensajes: 10
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: [Ayuda]Unexpected T_STRING, expecting ',' or ';'

Gracias por responder pero sigue sin efectuarse el onmouseover
el codigo es el siguiente:
Código PHP:
echo "<div id='Layer11' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:11'><a href='eregi.php' onMouseOut='MM_nbGroup(\'out\');' onMouseOver='MM_nbGroup(\'over\',\'boton1\',\'imagenes/boton1_a2.gif\',\'imagenes/boton1.gif\',2)' onClick='MM_nbGroup(\'down\',\'navbar2\',\'boton1\',\'imagenes/boton1_a2.gif\',1)'><img name='boton1' src='imagenes/boton1.gif' width='93' height='31' border='0' alt=''></a></div>";

intente seguir el tutorial que me dieron, pero no sirvio, cambie las comillas simples por las dobles y viceversa ademas de añadir "\" les muestro el codigo:
Código PHP:
echo '<div id="Layer11" style="position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:11"> 
  <a href="eregi.php" onMouseOut="MM_nbGroup(\"out\");" onMouseOver="MM_nbGroup(\"over\",\"boton1\","imagenes/boton1_a2.gif","imagenes/boton1.gif",2)" onClick="MM_nbGroup(\"down\",\"navbar2\",\"boton1\","imagenes/boton1_a2.gif",1)"><img name="boton1" src="imagenes/boton1.gif" width="93" height="31" border="0" alt=""></a></div>'
;

Alguna solucion?
  #7 (permalink)  
Antiguo 09/10/2009, 07:35
 
Fecha de Ingreso: abril-2008
Mensajes: 453
Antigüedad: 16 años
Puntos: 16
Respuesta: [Ayuda]Unexpected T_STRING, expecting ',' or ';'

sigue estando mal las comillas si en el onClick pones comillas simples en los parametros de la funcion que estas llamando tenes que usar comillas dobles y viceversa ejemplos

Código php:
Ver original
  1. echo '<a href="#" onClick="funcion(\'parametro1\',\'parametro2\',\''.$parametroInterno.'\')" >link</a>';
  2.  
  3. echo "<a href='#' onClick='funcion(\"parametro1\",\"parametro2\",\"$parametroInterno\")'>link</a>";
  #8 (permalink)  
Antiguo 09/10/2009, 08:05
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: [Ayuda]Unexpected T_STRING, expecting ',' or ';'



Cita:
Iniciado por pateketrueke Ver Mensaje
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #9 (permalink)  
Antiguo 09/10/2009, 13:56
 
Fecha de Ingreso: julio-2008
Mensajes: 10
Antigüedad: 15 años, 9 meses
Puntos: 0
Sonrisa Muchas gracias

Gracias por su ayuda pude realizar lo que queria, dejo el codigo si alguien busca algo parecido.
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = 

(img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
<body>
<?php
$vor = "eregi01.php";
$var = $_SERVER['REQUEST_URI'];
if(eregi($vor, $var)) {
echo "<div id='Layer10' style='position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:10'><img name='boton2' src='imagenes/boton1_a2.gif' width='93' height='31' border='0' alt=''></div>" ;
}
else {
echo '<div id="Layer11" style="position:absolute; left:209px; top:53px; width:92px; height:31px; z-index:11"> 
  <a href="eregi01.php" onMouseOut="MM_nbGroup(\'out\');" onMouseOver="MM_nbGroup(\'over\',\'boton1\',\'imagenes/boton1_a2.gif\',\'imagenes/boton1_a2.gif\',2)" onClick="MM_nbGroup(\'down\',\'navbar2\',\'boton1\',\'imagenes/boton1.gif\',1)"><img name="boton1" src="imagenes/boton1.gif" width="93" height="31" border="0" alt=""></a></div>';
}
?>
</body>
</html> 
Perdon por ser tan molestoso en especial mis disculpas a pateketrueke, pero no entendia muy bien tu tutorial soy novato en php, y muchas gracias samu22 me guie en tu mensaje para editar la comilla de los botones y sirvio de maravilla
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:50.