Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/01/2010, 06:51
turminator
 
Fecha de Ingreso: enero-2006
Ubicación: Barcelona, España
Mensajes: 126
Antigüedad: 18 años, 3 meses
Puntos: 1
Alternar enlaces con PHP

Después de pelearme con Javascript y no poder resolver el problema, pensé que se podría solucionar usando PHP. Para ello hice este código:

Código PHP:
<?php
    
// You can place PHP like this


$enlace[1]="<object width="340" height="285"><param name="movie" value="http://www.youtube.com/v/lAEfizVIn9A&hl=es_ES&fs=1&color1=0x234900&color2=0x4e9e00&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/lAEfizVIn9A&hl=es_ES&fs=1&color1=0x234900&color2=0x4e9e00&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="340" height="285"></embed></object>";
$enlace[2]="<object width="340" height="285"><param name="movie" value="http://www.youtube.com/v/jfrMY984cxM&hl=es_ES&fs=1&color1=0x234900&color2=0x4e9e00&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/jfrMY984cxM&hl=es_ES&fs=1&color1=0x234900&color2=0x4e9e00&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="340" height="285"></embed></object>";
$enlace[3]="<object width="340" height="285"><param name="movie" value="http://www.youtube.com/v/HINjxTLdSCI&hl=es_ES&fs=1&color1=0x234900&color2=0x4e9e00&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/HINjxTLdSCI&hl=es_ES&fs=1&color1=0x234900&color2=0x4e9e00&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="340" height="285"></embed></object>";


$total_enlaces=1;
while ( !empty(
$enlace[$total_enlaces+1]) ) {
        
$total_enlaces++;
}


$aleatorio=rand(1,$total_enlaces);



echo 
"$enlace[$aleatorio]";
?>
Parece que este todo bien pero a la hora de ejecutar el código no responde. Como debería de enviar la consulta?

Muchas gracias!