Welcome Guest, Not a member yet? Register   Sign In
Khaos :: KhEvent
#41

[eluser]egoslip[/eluser]
E1M2

Thanks so much for the clarification.. now I only have one more question. keep in mind I'm self thought php programmer and I'm now getting my head around the php class funtion never had any formal education on programing.

below is the mod I did to the _scan_directory i tried to keep the modifications to the file very minial. my thought is just look for every observer folder in each module and then just add it to the observer array.

But im getting an error when I load the modules_m model.. how can i fix this if you can help clarify this i would be greatly thankful

Code:
<?
        function _scan_directory($dirr /*rename from $dir*/)
        {
            $observers = array();
            //Start matchbox mod
            $this->load->model('modules_m'); //error starts here
            $modules=$this->modules_m->getModules();
            foreach($modules as $module){
                $dir='modules/'.$module['slug'].'/'.$dirr;
                //EOF matchbox mod
            if (($dh = @opendir($dir)) !== false)
            {
                while (($file = readdir($dh)) !== false)
                {
                    if ($file == '..' || $file == '.')
                        continue;
                        
                    if (is_dir($dir.$file))
                        $observers = array_merge($observers, $this->_scan_directory($dir.$file.'/'));
                    else
                    {
                        list($observer, $ext) = explode('.', $file);
                        
                        if (('.'.$ext) != EXT)
                            continue;
                            
                        $observers[] = array(
                            'name'     => $observer,
                            'location' => $dir.$file,
                            'modified' => filemtime($dir.$file)
                        );
                    }
                }
                
                closedir($dh);
                
                
            } }//added to close the foreach mod of matchbox
            return $observers;//moved out side of the foreach and if statment
        }

?>
#42

[eluser]E1M2[/eluser]
Need to pass a reference to the CI Instance and use this for each consecutive call... like so:

Code:
$CI =& get_instance();
$CI->load->model('modules_m');
$modules=$CI->modules_m->getModules();
#43

[eluser]egoslip[/eluser]
Thats what I thought but im getting this error when ever i try to use it

Fatal error: Call to undefined function get_instance()
#44

[eluser]E1M2[/eluser]
Just tried out the sample code in reply #41 by placing it after $observers = array(); in _scan_directory() to reproduce error. I was passed a reference to the CI instance.
#45

[eluser]Milos Dakic[/eluser]
Don't know if this is the same as the library I did.
#46

[eluser]E1M2[/eluser]
First time hearing about it. Thanks for the heads up.
#47

[eluser]brianw1975[/eluser]
Does anyone have the zip file that is in the OP? I can't get to the site and have been trying for close to 48 hours now.

Thanks!
#48

[eluser]wiredesignz[/eluser]
Attached.
#49

[eluser]brianw1975[/eluser]
Sweet!

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB