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

[eluser]Matt Egan[/eluser]
Thanks for the help guys. Here's my final piece of code. I also needed the currently active theme to be selected already, so I just went ahead and put it first in the array, this is so that if the user submits the form without changing the theme drop-down, the theme does not change. If there's any way to call the model from the model itself, that'd be cool, but I'm don't think you can.

Code:
function theme_list(){
    
    $theme_dir = "content/themes/";
    
    $this->db->where('field', 'theme_folder');
    $query = $this->db->get('config');
    $row = $query->row();
    $active = $row->value;
    
    $themes = array();

    $themes[] = $active;

    $handle = opendir($theme_dir);

    while ($entry = readdir($handle))  {
        
        if (filetype($theme_dir.$entry) == "dir" && $entry !="." && $entry !=".." && $entry != $active)    {
    
            $themes[] = $entry;
            
        }
    
    }
    
    return $themes;
    
}


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