Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/09/2010, 22:11
DigInDreams
 
Fecha de Ingreso: septiembre-2010
Ubicación: In my dreams ^^
Mensajes: 18
Antigüedad: 13 años, 7 meses
Puntos: 0
Pregunta Respuesta: Problema al obtener variable que inicie con un número desde PHP

Emprear:

Sí, se que debería funcionar, este problema no es primera vez que me sucede, y note que en ambas ocasiones el valor PHP de la variable lo obtengo para escribirlo en Javascript.

La primera vez fue para obtener un timeout desde la URL:

setTimeout("goHome()", <?php $vU = $_GET["v"]; echo $vU ?>);

En esta segunda vez el valor de la variable de "y" debe insertarse dentro de un "document.write" que debe escribir un Div y el Iframe con la dirección.

Dejare el código completo de la página [www.thydo.zzl.org]:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
  3.     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4.     <link rel="shortcut icon" href="/images/body/favicon.png" />
  5.     <script type="text/javascript" src="js/estilo.js"></script>
  6.     <script language="javascript">document.write("<title><?php if(isset($_GET["m"])) switch ($_GET["m"]){case 0: echo 'Thydo! Navigator'; break;} else{if(isset($_GET["y"])) switch ($_GET["y"]){case 0: echo 'Thydo! Video'; break;} else {if(isset($_GET["t"])) switch ($_GET["t"]){case 0: $t = $_GET["t"]; echo $t; break;} else echo'"+titulo+"';};};?></title>");</script>
  7.     <script language="javascript">document.write("<link href='"+estilo+"' rel='stylesheet' type='text/css'/>");</script>
  8.     <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
  9.     <script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script>
  10.     <script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
  11.     <script type="text/javascript" src="js/jquery-AeroWindow.js"></script>
  12.     <script type="text/javascript" src="js/anttu.js"></script>
  13.     <script type="text/javascript">$(document).ready(function(){$('#thydo').AeroWindow({WindowTitle:'<?php if(isset($_GET["m"])) switch ($_GET["m"]){case 0: $m = $_GET["m"]; echo 'Thydo! Navigator: ',$m,''; break;} else{if(isset($_GET["y"])) switch ($_GET["y"]){case 0: echo 'Thydo! Video'; break;} else echo'Thydo!';};?>',WindowMaximize:<?php if(isset($_GET["max"])) switch ($_GET["max"]){case 0: $max = $_GET["max"]; echo $max; break;} else echo'true';?>,WindowMinimize:<?php if(isset($_GET["min"])) switch ($_GET["min"]){case 0: $min = $_GET["min"]; echo $min; break;} else echo'true';?>,WindowClosable:<?php if(isset($_GET["close"])) switch ($_GET["close"]){case 0: $close = $_GET["close"]; echo $close; break;} else echo'true';?>,WindowStatus:'<?php if(isset($_GET["estado"])) switch ($_GET["estado"]){case 0: $st = $_GET["estado"]; echo $st; break;} else echo'regular';?>',WindowResizable:<?php if(isset($_GET["sz"])) switch ($_GET["sz"]){case 0: $sz = $_GET["sz"]; echo $sz; break;} else echo'true';?>,WindowPositionTop:'center',WindowPositionLeft:'center',WindowWidth:700,WindowHeight:500,WindowAnimation:'<?php if(isset($_GET["efecto"])) switch ($_GET["efecto"]){case 0: $efecto = $_GET["efecto"]; echo $efecto; break;} else echo'easeOutElastic';?>'});});</script>
  14. </head>
  15.     <div id="cp"><script language="javascript">document.write("<img src='"+crsrc+"' />");</script></div>
  16.     <div id="top"><div id="logo"><script language="javascript">document.write("<img src='"+logosrc+"' style='cursor: pointer;' title='Thydo!' />");</script></div></div>
  17.     <div id="Window1" style="display: none;"><p>Thydo!</p><p><strong><a href="#" style="color: #111; text-decoration:underline;">Añade tu publicidad aquí.</a></strong></p></div>
  18.     <script language="javascript">var video="<?php if(isset($_GET["v"])) switch ($_GET["v"]){case 0: $vU = $_GET["v"]; echo $vU; break;} else {};?>"; document.write("<div id='thydo' style='display: none;'><iframe width='100%' height='100%' style='border: 0px;' frameborder='0' src='http://<?php if(isset($_GET["m"])) switch ($_GET["m"]){case 0: echo $m; break;} else{if(isset($_GET["y"])) switch ($_GET["y"]){case 0: $y = $_GET["y"]; echo 'www.youtube.com/v/',$y,''; break;} else echo'"+metodo+"';};?>"+video+"'></iframe><div id='iframeHelper'></div></div>");</script>
  19. </body>
  20. </html>

Función de PHP: [Si no obtengo "m" obtengo "y" y sino muestro el valor de: "metodo", este ultimo especificado en www.thydo.zzl.org/js/anttu.js]

Código PHP:
Ver original
  1. <?php if(isset($_GET["m"])) switch ($_GET["m"]){case 0: echo $m; break;} else{if(isset($_GET["y"])) switch ($_GET["y"]){case 0: $y = $_GET["y"]; echo 'www.youtube.com/v/',$y,''; break;} else echo'"+metodo+"';};?>

¡Gracias!

AlejandroM! - Aprende haciéndolo™ [[email protected]]