hey guys,
this works fine:
$dir = new DirectoryIterator(get_template_directory().'/images/headers/');
however I don’t have just /headers but i have a /headers/summer and headers/winter directory that I wanna use as path depending on the current season.
$summer = array(3,4,5,6,7,8,9);
$path = null;
if ( in_array(date('n'), $summer) ) {
$path = get_template_directory().'/images/headers/summer/';
} else {
$path = get_template_directory().'/images/headers/winter/';
}
$dir = new DirectoryIterator($path);
What is wrong with this? My page is blank if I use this!
I think there are 3 possibilits..
the $path does not exists, check
with
if(!is_dir($path)) die('no dirthere');
your function get_template_directory
throws a fatal
you are using PHP4 where the class
DirectoryIterator does not exists