iterator - php directoryIterator - path based on season? -


hey guys, works fine:

$dir = new directoryiterator(get_template_directory().'/images/headers/'); 

however don't have /headers have /headers/summer , headers/winter directory wanna use path depending on 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 wrong this? page blank if use this!

i think there 3 possibilits..

  1. the $path not exists, check if(!is_dir($path)) die('no dir there');

  2. your function get_template_directory throws fatal

  3. you using php4 class directoryiterator not exists


Comments