danscreations Posted August 20, 2008 Share Posted August 20, 2008 I'm writing a simple gallery script which generates the navigation based off of the folder structure (to some degree). There are a series of folders and sub folders which generate each dropdown. In the dropdown for the chassis_folder there will either be several sub folders of chassis or there will be a single "ALL" folder. Not sure how to add/re-arrange my coding so that the script opens the $chassic_folder looks for the "ALL" folder and if it exsist set $chassis to equal "ALL" and if it doesn't exsist display each $display_chassis. Live script: http://www.ccwheel.com/dan/gallery.php $chassis_folder = 'gallery/'.$make.'/'.$model.'/'; $open_chassis = opendir($chassis_folder); if(empty($make)){ } else { if(empty($model)){ } else { echo '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="gallery_chassis_select">'; echo '<select name="chassis" onchange="document.gallery_chassis_select.submit()">'; echo '<option>Select Chassis</option>'; while($display_chassis = readdir($open_chassis)){ if(is_dir($display_chassis)){ } else { $chassis_files[] = $display_chassis; } } sort ($chassis_files); foreach ($chassis_files as $chassis_data){ echo '<option value="'; echo $chassis_data; echo '" '; if ($chassis_data == $chassis){ echo 'selected'; } echo '>'; echo $chassis_data; echo '</option>'; } echo '</select>'; echo '<input type="hidden" name="make" value="'; echo $make; echo '">'; echo '<input type="hidden" name="model" value="'; echo $model; echo '">'; echo '</form>'; echo '</td>'; echo '<td>'; } } closedir($chassis_folder); Link to comment https://forums.phpfreaks.com/topic/120547-if-than-statement-based-of-a-subfolder/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.