Now, just to finish my script:
<?php // Definizione dei path $path_gall = '../public/gallery'; $dirs = scandir($path_gall);foreach ($dirs as $cartella) { if($cartella == '.' || $cartella == '..') { continue; } $name = $cartella; $name = str_replace("_", " ", $name); // risostituisco gli underscore con gli spazi $name = str_replace("!a!", ", ", $name); // metto la virgola e lo spazio tra anno e mese $name = str_replace("!b!", " - ", $name); // metto il - tra anno e titolo $path_cart = "$path_gall/$cartella"; $inner = scandir($path_cart); echo "<a name = "$cartella"></br></br>"; echo "<h5>$name</h5></br>"; echo "<div style="width: 640px;">"; echo "<ul id="screenshotGallery">"; foreach ($inner as $photo) { if($photo == '.' || $photo == '..') { continue; } echo "<li><img src="$path_cart/$photo" /></li>"; } echo "</ul></div></br></br>"; }?>
I have this script, which takes all my photo folders and prints it on separate galleries. How can I insert an if statement that controls if the folder is empty in order to avoid to create the relative gallery?
The problem is that every folder is not really empty, in fact there are certainly the "." and the ".." folders!