Ver Mensaje Individual
  #7 (permalink)  
Antiguo 22/11/2012, 03:51
Avatar de Eleazan
Eleazan
 
Fecha de Ingreso: abril-2008
Ubicación: Ibiza
Mensajes: 1.879
Antigüedad: 16 años
Puntos: 326
Respuesta: Incorporar include dentro de xml con php

Uhm...

La idea sería esta...

Código PHP:
while($row mysql_fetch_array($result)) {
    
$pregunta[0]['nombre'] = $row['nombre'];
$pregunta[0]['score'] = 1;
$pregunta[1]['nombre'] = getNombre($row['sexo'], $link); //Así nos aseguramos que sea del mismo sexo!
$pregunta[1]['score'] = 0;
$pregunta[2]['nombre'] = getNombre($row['sexo'], $link);
$pregunta[2]['score'] = 0;
 
$pregunta shuffle($pregunta);  
 
    
        
printf("
            <question>
      <text>Pregunta</text>
      [<img src='%s' alt='Profile' />]
 
      <option>
        <text>%s</text>
        <score>%s</score>
      </option>
 
      <option>
        <text>%s</text>
        <score>%s</score>
      </option>
 
      <option>
        <text>%s</text>
        <score>%s</score>
      </option>
    </question>
        "
$row["img"], $row["pregunta"],$pregunta[0]['nombre'],$pregunta[0]['score'],$pregunta[1]['nombre'],$pregunta[1]['score'],$pregunta[2]['nombre'],$pregunta[2]['score'] );
 
 
    } 
Algo así haría... ¿pq?

Al principio, generamos un array en plan
0: "Fulanito", "1"
1: "Menganito", "0"
2: "Pablito", "0"

Después, hacemos un shuffle.. y quizás queda asi
0: "Menganito", "0"
1: "Fulanito", "1"
2: "Pablito", "0"

Asi pues, son 3 nombres + 3 puntuaciones q debes pasar al print, y quedaría algo como lo anterior ;)

Espero que esto te sirva :)
__________________
>> Eleazan's Source
>> @Eleazan