Diese Funktion zeigt täglich wechselnden Zufallstext an.
function RandomQuoteByInterval($TimeBase, $QuotesArray){
// Make sure it is a integer
$TimeBase = intval($TimeBase);
// How many items are in the array?
$ItemCount = count($QuotesArray);
// By using the modulus operator we get a pseudo
// random index position that is between zero and the
// maximal value (ItemCount)
$RandomIndexPos = ($TimeBase % $ItemCount);
// Now return the random array element
return $QuotesArray[$RandomIndexPos];
}
/*
** --> See the example section below for a
** detailed instruction.
*/
[/php]
Quelle: Jonas John
Mit der PHP Funktion kann man tägliche, wöchentliche usw. Zufalls Quotes einblenden.
function RandomQuoteByInterval($TimeBase, $QuotesArray){
// Make sure it is a integer
$TimeBase = intval($TimeBase);
// How many items are in the array?
$ItemCount = count($QuotesArray);
// By using the modulus operator we get a pseudo
// random index position that is between zero and the
// maximal value (ItemCount)
$RandomIndexPos = ($TimeBase % $ItemCount);
// Now return the random array element
return $QuotesArray[$RandomIndexPos];
}[/php]
Quelle: jonasjohn.de
Ein kleines Script zur Anzeige von zufälligen Inhalten in Webseiten. Die Inhalte werden in eine Textdatei mit Namen random.dat geschrieben. Jeweils ein Ausgabeblock pro Zeile.
Das kann Google Adsense Werbung, ein Banner, ein Text, was auch immer sein. Wichtig ist es, dass alles in einer Zeile geschrieben wird. Der Zeilenumbruch bestimmt das Ende des Anzeigeblocks. Weiterlesen