rotation wechsel

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • rotation wechsel

    hi,

    suche ein simples script damit bei jedem besuch per zufall ein anderes bild angezeigt wird. möchte das das script ohne js läuft.
    hat jemand eine idee`?

    danke

  • #2
    Ja, hab ich!
    PHP-Code:
    <?php
        $datafile 
    "random.dat";
        global 
    $datafile;
        
    $datei fopen($datafile"r");
        
    $message file($datafile);
        if(
    count($message) != "1") {
        
    $zahl rand("0"count($message) -1);
        }
        else {
        
    $zahl "0";
        echo 
    "<img src=\"" $message[$zahl] . "\" border=\"0\">";
        
    fclose($datei);
        }
    ?>
    So...diese Code-Zeilen packst du an die Stelle in der Seite, an der du das Bild haben möchtest. In die random.dat schreibst du dann deine Bilddateien - pro Zeile eine, also etwa so:
    PHP-Code:
    bild.jpg
    bild2
    .jpg
    bild3
    .jpg 
    Hoffe, ich konnte dir weiterhelfen!

    Kommentar

    Lädt...
    X