silvercross
14-02-2003, 10:08
Hallo ;)
Wollt euch folgendes Script zeigen, welches Zufallstexte ausgiebt , die in einer Include datei gespeichert sind. Das praktische daran ist, dass keine Datenbank dafür benötigt wird, hat ja schließlich nicht jeder..
Hier die Include Datei
<?php
$text[0] = "ich bin text 0";
$text[1] = "ich bin text 1";
$text[2] = "ich bin text 2";
$text[3] = "ich bin text 3";
$text[4] = "ich bin text 4";
?>
hier die php file
<?php
/*
* RANDOM TEXT OUTPUT
* TEXT DATA : texts.inc
* Output: $text[$new_random]
* Michael Beer, 13.02.2003, m.beer@mts-online.at
*/
// Includes the Text Files from the file
include("texts.inc");
// First Limit for Random Figure
$first_limt = "0";
// Second Limit is the latest figure present in $texts
$second_limt = "4";
// New Random figure is created
$new_random = rand($first_limit, $second_limt);
// Prints the Random Text with a bit of formating
print "<font face=arial color=green size=2><b>".$text[$new_random]."</b></font>";
// Link to reload page
print "<br><br><br><a href=\"$PHP_SELF\">RELOAD</a>";
?>
Wollt euch folgendes Script zeigen, welches Zufallstexte ausgiebt , die in einer Include datei gespeichert sind. Das praktische daran ist, dass keine Datenbank dafür benötigt wird, hat ja schließlich nicht jeder..
Hier die Include Datei
<?php
$text[0] = "ich bin text 0";
$text[1] = "ich bin text 1";
$text[2] = "ich bin text 2";
$text[3] = "ich bin text 3";
$text[4] = "ich bin text 4";
?>
hier die php file
<?php
/*
* RANDOM TEXT OUTPUT
* TEXT DATA : texts.inc
* Output: $text[$new_random]
* Michael Beer, 13.02.2003, m.beer@mts-online.at
*/
// Includes the Text Files from the file
include("texts.inc");
// First Limit for Random Figure
$first_limt = "0";
// Second Limit is the latest figure present in $texts
$second_limt = "4";
// New Random figure is created
$new_random = rand($first_limit, $second_limt);
// Prints the Random Text with a bit of formating
print "<font face=arial color=green size=2><b>".$text[$new_random]."</b></font>";
// Link to reload page
print "<br><br><br><a href=\"$PHP_SELF\">RELOAD</a>";
?>