View Single Post
Old 10-05-2012, 05:20 PM   PM User | #7
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Sorry you'll need to verify its a directory before as well.
PHP Code:
$directory "portfolio/$entry";
if (
is_dir($directory))
{
    
$aItems scandir($directory);
    
$aItemsFiltered array_filter($aItems'filterArrayOnlyDirectories');

As for debugging, the first step is to make sure that $aItems has directories within it. Perform a print_r($aItems); or a var_dump to make sure it has items within it. Then check that $aItemsFiltered also has data. If $aItems has data and $aItemsFiltered does not, make sure that the filterArrayOnlyDirectories function is within scope as an array_filter without a valid callback will always return false (and therefore have 0 results in the end).

I'm betting you do not have the function, unless you've modified it. I'd have a syntax error on this line: if (is_dir($itm) && !in_array($itm, array('.', '..')) since I'm missing a closing ).

Edit:
Oh yeah I forgot that glob has an ONLYDIR directive! Wait, does that include the '.' and '..' as well?
Fou-Lu is offline   Reply With Quote