arba
<?php
// directory where CSS files array
$css_dir = "./test/";
// creates the CSS Files array
$css_files = array();
// checks to see if $css_dir is legit
if (is_dir($css_dir)) {
// opens the directory
if ($dh = opendir($css_dir)) {
// cycles through all of the CSS files and adds them to array
while (($file = readdir($dh)) !== false) {
$css_files[] = $file;
}
// closes the dirtory
closedir($dh);
}
}
// this gets rid of the . and .. that appear in the directory
$css_files = array_slice($css_files, 2);
// this chooses a random CSS file and assigns it to the $rand_css_file
variable
$rand_css_file = $css_files[array_rand($css_files)]; ?>
<link rel="stylesheet" type="text/css" href="<?php echo
$css_dir.$rand_css_file ?>">
--
voxdizainas
-------------------------------------
www.voxdizainas.net