sur http://www.allhtml.com/php/php464.php
ils indiquebnt que pour qu´ une imùage soit affcihe au hasard il faut faire ça
PHP
Image aléatoire
1. Présentation
Ce script permet d´afficher une image différente à chaque chargement d´une page web, l´image étant choisie au hasard. Içi il y a quatre images de même taille.
2. Paramétrage
Définition du nombre d´images et de leurs noms. Le nombre des images est stocké dans la variable $nbimages et leurs noms dans le tableau $nomimages.
$nbimages=4;
$nomimages[1]="image1.jpg";
$nomimages[2]="image2.jpg";
$nomimages[3]="image3.jpg";
$nomimages[4]="image4.jpg";
3. Détermination aléatoire de l´image à afficher
Elle s´effectue à l´aide de la fonction rand() qui doit obligatoirement être initialisée avec la fonction srand() pour fonctionner. On stocke le résultat dans la vriable $affimage.
srand((double)microtime()*1000000);
$affimage=rand(1,$nbimages);
4. Affichage de l´image
C´est un affichage HTML normal en insérant juste du PHP pour le nom de l´image.
< img src="images/<?echo $nomimages[$affimage];?>" border=0 width=50 height=50 alt="Image aléatoire">
j´ ai modifié pour un texte ca donne ça:
< ?
$nbcitations=7;
$nomcitations[1]="citation1.txt";
$nomcitations[2]="citation2.txt";
$nomcitations[3]="citation3.txt";
$nomcitations[4]="citation4.txt";
$nomcitations[5]="citation5.txt";
$nomcitations[6]="citation6.txt";
$nomcitations[7]="citation7.txt";
srand((double)microtime()*1000000);
$affcitation=rand(1,$nbcitations);
include ( "$nomcitations[$affcitations]");
? >
c quoi le problème???Merci d´ avance