Welcome Guest, Not a member yet? Register   Sign In
Issue loading custom library from custom helper
#1

[eluser]dstegelman[/eluser]
Hey guys,

I tried a Google search and looked around a bit in Pyrocms before I posted this, but I have had this problem all night and I thought it might be best to seek some help.

I am having an issue loading a custom library from the helper that I have created. I am using Wiredesignz modular seperation.

Inside /application/helpers/controls_helper.php
I have
Code:
function projectDropdownList(){
    $CI =& get_instance();
    $CI->load->library('controls');

}

and inside /application/libraries/Controls.php
I have
Code:
class Controls {
    //put your code here


    private $ci;  

    public function  __construct() {
        $this->ci =& get_instance();
        $this->ci->load->database();
    }


    public function getProject($projectID){
      

        if ($projectID == 0){


        $projectData = $this->ci->db->get('projectTable');

        } else {


            $projectData = $this->ci->db->get_where('projectTable', array('projectID'=>$projectID));
        }


        return $projectData;

    }
}

When I try to use the controls helper function I get this error back from MY_Loader.php
Code:
ErrorException [ Notice ]: Undefined property: CI::$controls
APPPATH/third_party/MX/Loader.php [ 144 ]
139             CI::$APP->$_alias = new $library($params);
140             $this->_ci_classes[$class] = $_alias;
141         }
142        
143         $this->_ci_assign_to_models();
144         return CI::$APP->$_alias;
145                
146     }
147
148     /** Load an array of libraries **/
149     public function libraries($libraries) {

I can't seem to reach the CI super object or something.
#2

[eluser]nuwanda[/eluser]
Are we on related topic here?

Link

Should you be calling your method statically?
#3

[eluser]dstegelman[/eluser]
Thats a good point, but not really the problem. The error I'm getting seems to be caused by Modular Seperation, but I am just not sure.
#4

[eluser]dstegelman[/eluser]
RESOLVED:

I removed the MY_Controller.php from core and I can now load the correct libraries and models into the helper.




Theme © iAndrew 2016 - Forum software by © MyBB