Ver Mensaje Individual
  #22 (permalink)  
Antiguo 07/02/2011, 09:03
mangels
 
Fecha de Ingreso: marzo-2005
Mensajes: 41
Antigüedad: 19 años, 1 mes
Puntos: 0
Respuesta: Código que funciona con PHP4 y no con PHP5

Gracias abimaelrc por tu contacto.

Sin embargo, no tengo conocimientos suficientes de PHP para interpretar tu respuesta ¿Cómo integro el código que me diste al código que ya tengo?

Yo aquí voy a copiar el código completo incluyendo la parte donde se inserta la información de los banners, para que tengas una idea de cómo funciona todo el script (el nombre de los banners y las URL a las cuales enlazan fueron reemplazados por 1, 2, 3, 4, etc. por razones obvias):

-------------------------------------------------------------------
<?php
//***this script is being used by display.php and template.php***

//banners in the center part of the site 468x60px
//following this format: ['banner_image.xxx']['page_url_to_point']
$center_banners['/images/ads/center/1.jpg']='/1.php';
$center_banners['/images/ads/center/2.gif']='http://2.com/';
$center_banners['/images/ads/center/3.jpg']='http://3.com/';
$center_banners['/images/ads/center/4.jpg']='http://4.com/';
$center_banners['/images/ads/center/5.gif']='http://5.com/';

//banners in the left part of the site 125x125px
//following this format: ['banner_image.xxx']['page_url_to_point']
$left_banners['/images/ads/left/1.jpg']='/1.php';
$left_banners['/images/ads/left/2.gif']='http://www.2.com/';
$left_banners['/images/ads/left/3.gif']='http://www.3.com/';
$left_banners['/images/ads/left/4.gif']='http://www.4.com/';
$left_banners['/images/ads/left/5.gif']='http://www.5.com/';
$left_banners['/images/ads/left/6.gif']='http://6.com/';
$left_banners['/images/ads/left/7.gif']='http://7.com/';
$left_banners['/images/ads/left/8.jpg']='http://www.8.com/';

//banners in the right part of the site 120x60px
//following this format: ['banner_image.xxx']['page_url_to_point']
$right_banners['/images/ads/right/1.jpg']='/1.php';
$right_banners['/images/ads/right/2.jpg']='http://www.2.com/';
$right_banners['/images/ads/right/3.gif']='http://www.3.com/';

/************************************************** ***********/
/* DO NOT TOUCH ANYTHING UNDER THIS LINE /
/************************************************** ***********/

//randomly shuffle the array keeping the relation between keys and values
function shuffle_me($shuffle_me){
$randomized_keys = array_rand($shuffle_me, count($shuffle_me));
foreach($randomized_keys as $current_key) {
$shuffled_me[$current_key] = $shuffle_me[$current_key];
}
return $shuffled_me;
}
$center_banners=shuffle_me($center_banners);
$center_banners=array_slice($center_banners, 0, 20);

$left_banners=shuffle_me($left_banners);
$right_banners=shuffle_me($right_banners);

?>

--------------------------------------------------------------

Como se ve, mi código también maneja shuffle, pero cómo debería quedar exactamente para que funcione en PHP5?

Gracias por cualquier ayuda