I decided to use the singleton template for my application. It matters to me the most. However, when I feel like I have made some progress, I run into another wall.
I have a download function. The download function does the following.
Check if the class has been previously loaded. - If so, return $ class :: get_instance (); - Otherwise - look for the class in different places - if found - return $ class :: get_instance (); - else return error.
Before using the Singleton template, I created classes with a load class.
In the controller, I would do that.
$session = $this->load->library('session');
Then the load class will find the file and return.
return new $class_name;
I was hoping that when changing the method of loading classes, this will be a setting for several lines, but these settings generate syntax errors.
return $class_name::get_instance();
Is there a way to write the line above without a syntax error?
source
share