Welcome Guest, Not a member yet? Register   Sign In
Application structure?
#1

[eluser]Rein[/eluser]
Dear CI-users,

I'm pretty new to CodeIgniter and I'm very excited. From what I see from this framework, this is exactly what I'm looking for.

Now I have a question regarding the structure of my application.

I'm trying to get my application to automaticaly show the controllers available. I created a model to do this. But I think this is a wrong approach. Here is my "model":

Code:
<?
class Modules extends Model {

    function Modules()
    {
        parent::Model();

    }
    
    function getmodules()
    {
        $handle = opendir('./system/application/controllers');
        while(false != ($file = readdir($handle))){
            $extension = strtolower(substr(strrchr($file, '.'), 1));
            if($extension == 'php'){
                $file = str_replace('.php', '', $file);
                $modules[] = $file;
            }
        }
        return $modules;
    }
    
}
?>

It just feels strange to load this model directly in my layout view file to have a menu showing the controllers.


What would you guys do to get the desired result?


Thanks for any help!


An exciting CI-starter.


Messages In This Thread
Application structure? - by El Forum - 04-18-2010, 05:38 AM
Application structure? - by El Forum - 04-18-2010, 12:46 PM
Application structure? - by El Forum - 04-18-2010, 02:16 PM
Application structure? - by El Forum - 04-18-2010, 04:13 PM
Application structure? - by El Forum - 04-18-2010, 04:20 PM
Application structure? - by El Forum - 04-18-2010, 04:25 PM
Application structure? - by El Forum - 04-18-2010, 04:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB