Welcome Guest, Not a member yet? Register   Sign In
Getting Folders in A Directory
#4

[eluser]jedd[/eluser]
Hi Matt - site looks good.

Have you tried using the standard PHP opendir() / is_dir() functions?

Untested, but possibly something like:
Code:
$theme_dir = $base_url() ."/assets/themes/";

$themes = array ();

$td_handle = opendir($theme_dir);

while ($dir_entry = readdir ($td_handle))  {
    if (filetype ($dir_entry) == "dir")
        $themes[] = $dir_entry;
    }

Note that you'll get . and .. as directories - this has bitten me before, but it's easy to check for. Similarly you'd want some other error handling around there too, of course - confirming the themedir exists, and so on.


Messages In This Thread
Getting Folders in A Directory - by El Forum - 03-23-2009, 07:05 PM
Getting Folders in A Directory - by El Forum - 03-23-2009, 07:23 PM
Getting Folders in A Directory - by El Forum - 03-23-2009, 07:27 PM
Getting Folders in A Directory - by El Forum - 03-23-2009, 07:28 PM
Getting Folders in A Directory - by El Forum - 03-23-2009, 07:59 PM
Getting Folders in A Directory - by El Forum - 03-23-2009, 08:06 PM
Getting Folders in A Directory - by El Forum - 03-24-2009, 06:47 PM
Getting Folders in A Directory - by El Forum - 03-24-2009, 07:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB