Snippet Name: documentMan Description: Calls in directory contents. Paste PHP code below into Snippet code (php) text area. config['(site_url)'].'assets/images/'.$Location.'/'; // set path to files $dir_array = array(); // main array - contains all file names in directory //Greg Hack for stripping file extensions function strip_ext($name) { $ext = strrchr($name, '.'); if($ext !== false) { $name = substr($name, 0, -strlen($ext)); } return $name; } // open directory and parse file list if (is_dir($dir)) { if ($dh = opendir($dir)) { // iterate over file list to create full directory array while (($filename = readdir($dh)) !== false) { if (($filename != ".") && ($filename != "..") && ($filename !="WS_FTP.LOG") && (!preg_match('/^.thumb_/', $filename))) { // skip self, parent, and ftp log and thumb prefix if returning images $dir_array[] = $filename; // add the filename to the array } } closedir($dh); // close directory } // natsort($dir_array); // sort in ascending order -- delete if you don't need them sorted. $dir_array = array_reverse($dir_array, false); // reverse array (descending) if needed. $n = count($dir_array); // total number of files -- might want this for something $output = ''; foreach ($dir_array as $value) { // iterate through array of filenames. $output .= '