ok thanks for the above,
i have added the function to my page and added these two lines in my while loop
PHP Code:
$aItems = scandir($directory);
$aItemsFiltered = array_filter($aItems, 'filterArrayOnlyDirectories');
like so
PHP Code:
#get portfolio categories
if ($handle = opendir('portfolio'))
{
#echo "Directory handle: $handle\n";
#echo "Entries:\n";
$x = 1;
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle)))
{
#echo $entry;
if ($entry != "." && $entry != "..")
{
#count folders inside directorys
$directory = "portfolio/$entry";
$aItems = scandir($directory);
$aItemsFiltered = array_filter($aItems, 'filterArrayOnlyDirectories');
if (($x % 3) == 0)
{
$className = "col-2";
}
else
{
$className = "col-1";
}
?>
<div class="<?php echo $className?>">
<figure class="img-box">
<a href="portfolio-weddings.html">
<img src="images/page3-img1.jpg" alt="">
</a>
</figure>
<div class="gallery-meta">
<a href="#" class="gallery-name"><?php echo ucwords($entry);?></a>
<span class="capacity">(<?php echo count($aItemsFiltered); ?> Albums)</span>
</div>
</div><?php
$x++;
}
}
closedir($handle);
}?>
i tried to echo out $aItemsFiltered and it returned 'array' so i then tried echo count($aItemsFiltered) and it always returns 0 even though at least on of my directories has a folder within it?
am i using it correctly? maybe my loop is incorrect?
cheers mate
Luke